$lookup 查询关联字段
表1 54fa3873a23a524351cf4980c746de0.png
表2

表1【Album】的 kind 字段关联的表2【imgSort】,
let albumFun = await Album.aggregate([{
$lookup: {
from: "imgSort",
localField: 'kind',
foreignField: "_id",
as: "inventory_docs"
}
}]);
这样查询 inventory_docs 永远都是空的,请教一下大家 是什么原因?
6 回复