Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to specify a no-timeout option on the cursor? [duplicate]

Tags:

ruby

mongodb

How to specify a no-timeout option on the cursor?

I can run the job manually and from my laptop but something is going on the server and all the time I am getting this error:

MONGODB cursor.refresh() for cursor xxx Query response returned CURSOR_NOT_FOUND. Either an invalid cursor was specified, or the cursor may have timed out on the server. MONGODB cursor.refresh() for cursor yyy

The job is ran from a ruby scheduler file that and is specified as a namespace in rake rake is calling for another ruby module in the middle, and the job dies during the execution of this module

I asked this question earlier and it got downvoted. Please, instead of downvoting explain what is so stupid about it, because I really need to solve this problem and can't figure out what is going on.

The server is kind of experimental and does not have any monitoring tools. But it seems to be reliable. And there are no other jobs running.

like image 272
Tyra Avatar asked Jun 05 '12 23:06

Tyra


1 Answers

See the FAQ for the Ruby MongoDB driver for details on how to turn off the cursor timeout.

Example from there:

@collection.find({}, :timeout => false) do |cursor|
   cursor.each do |document
     # Process documents here
   end
end
like image 79
JohnnyHK Avatar answered Sep 23 '22 14:09

JohnnyHK