Details
Description
The count command does not ignore orphans like find/queries. This is true whether the query is on the primary or secondaries (which is known to be a different issue).
For a query like this the count can come back larger if there are orphaned docs, but find will filter them out:
// more than one shard has the document with x:10, some of which are orphans from migrations
|
> coll.count({x:10})
|
2
|
> coll.find({x:10}).toArray()
|
[{_id:10, x:10}]
|
> coll.find({x:10}).explain() // some of the explain is removed for brevity
|
{
|
"clusteredType" : "ParallelSort",
|
"shards" : { ... },
|
"n" : 1,
|
"nChunkSkips" : 1,
|
"numQueries" : 2,
|
"numShards" : 2,
|
"millis" : 2
|
}
|
Attachments
Issue Links
- duplicates
-
SERVER-5931 Secondary reads in sharded clusters need stronger consistency
-
- Closed
-
- related to
-
SERVER-3645 Sharded collection counts (on primary) can report too many results
-
- Closed
-