[DOCS-10284] Comment on: "manual/reference/operator/aggregation/lookup.txt" Created: 19/May/17  Updated: 03/Nov/17  Resolved: 19/May/17

Status: Closed
Project: Documentation
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Docs Collector User (Inactive) Assignee: Unassigned
Resolution: Cannot Reproduce Votes: 0
Labels: collector-298ba4e7
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Location: https://docs.mongodb.com/v3.2/reference/operator/aggregation/lookup/
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36
Referrer: https://www.google.dk/
Screen Resolution: 1600 x 900


Participants:
Days since reply: 6 years, 38 weeks, 5 days ago

 Description   

doesnt fucking work



 Comments   
Comment by Kay Kim (Inactive) [ 19/May/17 ]

> db.orders.find()
{ "_id" : 1, "item" : "abc", "price" : 12, "quantity" : 2 }
{ "_id" : 2, "item" : "jkl", "price" : 20, "quantity" : 1 }
{ "_id" : 3 }
> db.inventory.find()
{ "_id" : 1, "sku" : "abc", "description" : "product 1", "instock" : 120 }
{ "_id" : 2, "sku" : "def", "description" : "product 2", "instock" : 80 }
{ "_id" : 3, "sku" : "ijk", "description" : "product 3", "instock" : 60 }
{ "_id" : 4, "sku" : "jkl", "description" : "product 4", "instock" : 70 }
{ "_id" : 5, "sku" : null, "description" : "Incomplete" }
{ "_id" : 6 }
> db.orders.aggregate([
...     {
...       $lookup:
...         {
...           from: "inventory",
...           localField: "item",
...           foreignField: "sku",
...           as: "inventory_docs"
...         }
...    }
... ])
{ "_id" : 1, "item" : "abc", "price" : 12, "quantity" : 2, "inventory_docs" : [ { "_id" : 1, "sku" : "abc", "description" : "product 1", "instock" : 120 } ] }
{ "_id" : 2, "item" : "jkl", "price" : 20, "quantity" : 1, "inventory_docs" : [ { "_id" : 4, "sku" : "jkl", "description" : "product 4", "instock" : 70 } ] }
{ "_id" : 3, "inventory_docs" : [ { "_id" : 5, "sku" : null, "description" : "Incomplete" }, { "_id" : 6 } ] }

Generated at Thu Feb 08 08:00:12 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.