-
Type: Improvement
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Aggregation Framework
-
Major Change
-
Query 11 (03/14/16), Query 12 (04/04/16)
Example Order Document:
{ _id: ObjectId("..."), products: [ ObjectId("..<Car ObjectId>.."), ObjectId("..<Bike ObjectId>..") ] }
Not Working Query:
db.orders.aggregate([ { $lookup: { from: "products", localField: "products", <= array of IDs foreignField: "_id", as: "productObjects" } } ])
Desired Result
{ _id: ObjectId("..."), products: [ ObjectId("..<Car ObjectId>.."), ObjectId("..<Bike ObjectId>..") ], productObjects: [ {<Car Object>}, {<Bike Object>} ], }
source: http://stackoverflow.com/questions/34967482/lookup-on-objectids-in-an-array
- is duplicated by
-
SERVER-21469 $lookup is not working in case of the localField is array
- Closed
-
SERVER-23180 array in $lookup localField should not be interpreted literally
- Closed
- is related to
-
SERVER-32494 $lookup should have option not merge duplicate array item in result (not auto unique)
- Closed