python - Iterating over a mongodb collection doesn't return all objects -


i have cron job runs simple script on mongo database:

import pymongo db=pymongo.connection().dbase ids=[] obj in db.coll.find(): ids.append(obj['_id']) # log len(ids), db.coll.count() 

in logs db.coll.count() 651 , len(ids) 651 too, 5,85,71 or other random numbers below 651. can explain why discrepancy happens , how prevent please?

the environment is: standalone server multiple clients may update objects in collection concurrently.


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -