It sounds weird, and I hope I'm doing something wrong, but my MongoDB collection returns a counter alone in my collection.
I have a collection with (I'm sure) 359671 documents. However, the count () command returns 359670 documents.
I execute the count () command using the mongo shell:
rs0:PRIMARY> db.COLLECTION.count() 359670
This is not true.
He does not find every document in my collection.
If I count the following query, I get the correct result:
rs0:PRIMARY> db.COLLECTION.count({_id: {$exists: true}}) 359671
I believe this is a bug in WiredTiger. As far as I know, each document has the same definition, the integer _id field from 0 to 359670 and the BinData field. I did not have this problem with an older storage engine (or Mongo 2, this could cause the problem).
Am I doing something wrong? I do not want to use the query {_id: {$ exists: true}}, since it takes 100 times to complete.
James source share