-
Type:
Bug
-
Resolution: Duplicate
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query Execution
-
ALL
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Example:
db.agg_test.insertOne({"a": [31415, 9265]});
db.agg_test.aggregate([{$project: {"a.b": 1, "c": {$const: "test"}}}, {$addFields: {"a.d": "zzz"}}]);
Result would be:
"a" : [ { "d" : "zzz" }, { "d" : "zzz" } ], "c" : "test" }
Projection {"a.b": 1} will remove all scalar elements from the array "a" as per projection definition.
Additional $const expression is needed to use default projection implementation instead of a simplified one.
When projection iterates through array, it replaces deleted scalar values with "missing " values and then $addFields stage replaces "missing" values with objects.
- duplicates
-
SERVER-50779 ProjectionExecutor incorrectly leaves tombstones when evaluating arrays
-
- Backlog
-