-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query Optimization
-
ALL
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Some operations ensure the prefix of the path is an object.
$lookup: {as: “a.b”} -> recreates a.b as objects if they are arrays, because it uses setNestedField
Enterprise test> db.test.aggregate([{$set: {b: [{c: []}]}}, {$lookup: {pipeline: [{$documents: []}], as: 'b.c.d'}}])
{ a: 2, b: { c: { d: [] } } }
Enterprise test> db.test.aggregate([{$set: {b: [{c: []}]}}, {$set: {'b.c.d': []}}])
{ a: 2, b: [ { c: [] } ] }
If the prefix contains arrays, the arrays are replaced with objects (contents discarded).
We should handle this correctly in the graph.
If we do not, we will incorrectly report that $lookup with as:"a.b" does not modify "a.c" when actually, if "a" is an array, it will be discarded, thus "a.c" is modified.
This requires a change in describeTransformation and the graph code.
- is related to
-
SERVER-123929 Track arrayness through $lookup+$unwind in the dependency graph
-
- In Progress
-