I am trying to use mongo 3.4 $lookup:function
db.orders.aggregate([
{
$lookup:
{
from: "inventory",
localField: "item",
foreignField: "sku",
as: "inventory_docs"
}
}
])
orders:
{ "_id" : 1, "itemid" : "1234", "price" : 12, "quantity" : 2 }
invdentory :
{ "_id" : 1, "skuid" : 123, description: "product 1", "instock" : 120 }
The problem here is the fields to be joined are of string and integer. How can i make this lookup possible in mongo