-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: Distributed Query Planning
-
None
-
Query Optimization
-
ALL
-
-
None
-
None
-
None
-
None
-
None
-
None
-
None
When a DISTINCT_SCAN is used for a distinct query on a sharded collection, mongos doesn't perform an aggregate "distinct" over the results returned from each targeted shard. Instead, it sums up the distinct values returned from each shard, giving us an incorrect overall nReturned result.
Shard0: 10 distinct values on "a"
Shard1: 10 distinct values on "a"
This returns 20 instead of 10:
const explain = coll.explain("executionStats").distinct("a");
- depends on
-
SERVER-1812 Add the ability to get query results and the query plan in one call
-
- Backlog
-
- is related to
-
SERVER-29449 Explain of find command does not transform query for shards
-
- Closed
-