- 
    Type:
Task
 - 
    Resolution: Won't Do
 - 
    Priority:
Major - P3
 - 
    None
 - 
    Affects Version/s: None
 - 
    Component/s: None
 - 
    None
 
- 
        Query Execution
 - 
        None
 
- 
        None
 - 
        None
 - 
        None
 - 
        None
 - 
        None
 - 
        None
 
The server's logic to determine a document key given a field list is nontrivial, which just bit us in a pair of bug tickets: REP-6462 and REP-6465.
We'd like to stop computing this ourselves, which we could do if the server exposed its logic in an aggregation operator.
Example:
{
  $_internalComputeDocKey: {
    document: {
      _id: 123123,
      foo: {
        "bar.baz": 2,
        bar: { baz: 3 },
      },
    },
    fields: ["_id", "foo.bar.baz", "qux"],
  },
}
It would yield this document:
{
  _id: 123123,
  "foo.bar.baz": 2,
} 
- depends on
 - 
                    
SERVER-109190 Inconsistent BSON path traversal logic
-         
 - Closed
 
 -         
 
- is related to
 - 
                    
SERVER-109340 Change stream `documentKey` misreports shard key for dotted fields.
-         
 - Blocked
 
 -         
 - 
                    
SERVER-109190 Inconsistent BSON path traversal logic
-         
 - Closed
 
 -         
 - 
                    
SERVER-68685 Add new $_internalIndexKey agg expression
-         
 - Closed
 
 -