java - Mongodb cursor inconsistent behavior -


i have collection on billion documents. when iterate on them cursor , processing, don't docs. however, if iterate on collection , count, return right count.

double c = 0; while(cursor.hasnext){       dbobject entity = entities.next();       //do       c+=1     }  assert(c==446642690.0) 

the assertion fails unless don't , count.

are doing updates or deletes during processing? if case running issue mongo cursor not isolated updates/inserts during lifetime. can partially avoid behaviour snapshot mode it's limited. see mongo documentation under cursor isolation more information issue. mongo designed work way think need find way deal situation.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -