I have a rake task that processes a set of records and saves it in another collection:
batch = []
Record.where(:type => 'a').each do |r|
batch << make_score(r)
if batch.size %100 == 0
Score.collection.insert(batch)
batch = []
end
end
I'm processing about 100K records at a time. Unfortunately at 20 minutes, i get a "Query response returned CURSOR_NOT_FOUND" error. The mongodb faq[1] says to use skips and limits or turn off timeouts. I found the skips and limits was about ~2-3 times slower.
How can i turn off timeouts in conjunction with mongoid?