//1两表联合查询
db.orders.aggregate([
{
$lookup:
{
from: "inventory",//附表
localField: "item.name",//主表字段
foreignField: "sku",//附表字段
as: "inventory_docs"//附表查询结果在主表显示的字段
}
}
])
2022-09-16 20:40:18
//1两表联合查询
db.orders.aggregate([
{
$lookup:
{
from: "inventory",//附表
localField: "item.name",//主表字段
foreignField: "sku",//附表字段
as: "inventory_docs"//附表查询结果在主表显示的字段
}
}
])