我有两个问题比较疑惑:
db.accounts.aggregate([
$lookup: {
from: xxx,
localField: xxx,
foreignField: xxx,
let: { xxx: xxx},
pipeline: {
....
}
}
])
实际例子就是,我想要accounts集合的currency字段和 forex集合 的ccy字段关联,并且如果forex集合ccy字段有多个相同的USA的汇率,只是时间不同,我需要关联时间最新的那一个文档,该怎么写呢~。不知道我的意思表达清楚了没。。