AD9*_*D95 1 mongodb mongodb-query
如何将对象 id 转换为字符串,以便可以将其与 $eq 中的字符串进行比较。蒙戈版本 - 4.0
db.user.aggregate([{
$lookup:{
from: "sometable",
let:{user:["$_id"]},
pipeline:[{
$match: {
$expr: {
$and:[
{
$eq: [ "$userId", "$$user"]
},
{
$gt: [ "$lastBalance", 0]
}
]
}
}
}
],
as: "response"
},
}])
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3152 次 |
| 最近记录: |