Reputation: 75945
I have quite an intensive operation that has a MongoCursor
run in a loop for a few hours (on a vb.net app running via the c# driver. I'm not too sure what causes it but I run into an exception after a while
Cursor not found
This could be because of a cursor timeout, perhaps? Is there a way I can stop it happening? If its a timeout issue how do I place a longer timeout?
Upvotes: 6
Views: 5701
Reputation: 895
I'm using MongoDB.Driver version 2.4.4 and IFindFluent
is not containing SetFlags
method. using this instead:
cursor.Options.NoCursorTimeout = true;
Upvotes: 1
Reputation: 41
Further clarifying JohnnyHK's answer, this is the syntax:
MongoCursor<BsonDocument> cursor = myCollection
.Find(query)
.SetSortOrder(SortBy.Ascending("TrackingNumber"))
.SetFlags(QueryFlags.NoCursorTimeout);
Upvotes: 2