Details
-
Task
-
Resolution: Done
-
Major - P3
-
None
-
None
Description
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
Attachments
Issue Links
- documents
-
SERVER-22881 lookup between local (multiple)array of values and foreign (single) value
-
- Closed
-
- is duplicated by
-
DOCS-9609 Clarify lookup between local (multiple) array of values and foreign (single) value
-
- Closed
-
-
DOCS-10630 Comment on: "manual/reference/operator/aggregation/lookup"
-
- Closed
-
-
DOCS-12756 Update documentation regarding using $lookup on array as localField
-
- Closed
-