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

Capture and play voice with Asterisk ARI -

c++ - Can not find the "fiostream.h" file -

visual studio - Installing Packages through Nuget - "Central Directory corrupt" -