【发布时间】:2019-08-17 13:15:51
【问题描述】:
我正在学习 MongoDB,并且对 NoSQL 非常陌生。
我有 2 个这样的收藏:
客户:
帐号:
我想通过客户集合中的 _id 和帐户集合中的 cust_id 创建客户和帐户集合之间的连接查询。我试过这个:
db.Customer.aggregate({
$lookup:{
from:"Account",
localField:"_id",
foreignField:"cust_id",
as:"customer_account"
}}).pretty()
但我的“customer_account”返回一个空数组。我该如何解决这个问题?非常感谢!
【问题讨论】:
标签: mongodb