A bug in aggregation's Wizard $lookup : It is not showing the accurate values for local & foreign fields.
A bug in aggregation's Wizard $lookup as it is not showing the accurate values for local & foreign fields. See the attached image
db.orders.insertMany([
{ "id" : 1, "item" : "almonds", "price" : 12, "quantity" : 2 },
{ "id" : 2, "item" : "pecans", "price" : 20, "quantity" : 1 },
{ "_id" : 3 }
])
db.inventory.insertMany([
{ "id" : 1, "sku" : "almonds", "description": "product 1", "instock" : 120 },
{ "id" : 2, "sku" : "bread", "description": "product 2", "instock" : 80 },
{ "id" : 3, "sku" : "cashews", "description": "product 3", "instock" : 60 },
{ "id" : 4, "sku" : "pecans", "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"
}
}
])