Recently, I wrote a tiny app to query data from MongoDB with pymongo. The code as following shown
colls = collection.find({'created': {'$gt': datetime.datetime(2014, 9, 14, 10),
'$lt': datetime.datetime(2014, 9, 14, 17)}},
{'created':1, '_id': 0})
print 'Totally count is ', colls.count()
So far, everything is okay. However,
results = []
for item in colls:
results.append(item)
I found that the length of results is less than colls.count(). It was so strange? Why they are different?