-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Aggregation Framework
-
Query Optimization
-
Minor Change
Consider a collection with documents of the shape
{
loc: {type: "Point", coordinates: [1.2, 1.1]},
nested: {field: 7}
}
This aggregation using the $geoNear stage computes new fields in "nested":
db.collection.aggregate({ $geoNear: { near: {type: "Point", coordinates: [0, 0]}, distanceField: "nested.dist", includeLocs: "nested.pt" } })
However, the aggregation system overwrites the field "nested.field", even though it could be preserved. This behavior occurs if the existing document field shares a prefix with either the "distanceField" or "includeLocs" options.
This ticket is a request to preserve as much existing information as possible.