-
Type: Task
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Labels:None
Description
Description:
This line on the $arrayToObject documentation is incorrect:
https://docs.mongodb.com/manual/reference/operator/aggregation/arrayToObject/"If the name of a field repeats in the array, $arrayToObject uses the first value for that field."
BEFORE this fix, which field was used when there are repeats was language/driver dependent.
AFTER this fix, the last field will always be used when there are repeats.
Feel free to email me if you have any questions!
Engineering Ticket Description:
Using $arrayToObject on an array of {k: ..., v: ...} objects where some k are repeating outputs an object that behaves inconsistently.
Referencing this object as a whole using "$object" outputs an object with a field value that is different compared to the value obtained by referencing the field directly using "$object.field".
Scope of changes
Impact to Other Docs
MVP (Work and Date)
Resources (Scope or Design Docs, Invision, etc.)
- documents
-
SERVER-37182 Different values when referencing whole object vs. a field of that object after $arrayToObject
- Closed