Mongo not returning full data from query
I am using PyMongo and Mongo version db version v1.4.1, pdfile version 4.5
When I try to query the database I am always getting different results. The code looks like this:
familycollection = conn.picdata
pics = familycollection[place]
pictures = [i for i in pics.find()]
return pictures
However pictures doesn't full return all my data. There are 8 total elements in the collection and I am getting sometimes a full response and other times a small response.
>>> len(pictures)
4
>>> pics.count()
5
>>> for i in range(10):
... pics.count()
...
5
5
5
6
7
8
8
8
8
8
Any help?
Thanks, J开发者_JAVA技巧ames
After working on this for a while I realized I was doing the reads too fast and needed to wait a little time.
James
If your read is using an index and your scan has already started and during that time there is another thread that comes and inserts a document mongo will not be able to read that document. Reads may miss matching documents updated during the course of read.
精彩评论