- 
    Type:
Bug
 - 
    Resolution: Unresolved
 - 
    Priority:
Major - P3
 - 
    None
 - 
    Affects Version/s: 8.0.12
 - 
    Component/s: None
 - 
    None
 
- 
        Query Execution
 - 
        ALL
 - 
        
 - 
        None
 
- 
        None
 - 
        None
 - 
        None
 - 
        None
 - 
        None
 - 
        None
 
Given a shard key {"a.b": 1} on a collection split at {"a.b": 100}, across 2 shards.
This works:
insertMany([{_id: 1, a: {b: 50}}, {_id: 1, a: {b: 150}}])
... but this fails due to a duplicate key error:
 insertMany([{_id: 1, "a.b": 50}, {_id: 1, "a.b": 150}])
This is all fine: it means that the routing doesn't recognize the literal a.b field; it only checks the embedded document.
If, however, you open a change stream and insert this document:
{ "a.b": 50, a: {b: 150}}
... the documentKey in the insert event will include "a.b": 50.
Thus, the change stream is saying that the shard key indexes on the literal a.b field, which is incorrect.
Seen in 8.0.12; this may be a longstanding issue, though.
- is blocked by
 - 
                    
SERVER-109190 Inconsistent BSON path traversal logic
-         
 - Closed
 
 -         
 
- related to
 - 
                    
SERVER-109190 Inconsistent BSON path traversal logic
-         
 - Closed
 
 -         
 - 
                    
SERVER-109181 Add aggregation operator to determine doc key given fields list.
-         
 - Closed
 
 -