【发布时间】:2018-06-01 13:19:41
【问题描述】:
将查询转换为节点。 arrayfilter 在哪个版本中可以在 mongoose 中运行,或者如何在节点应用程序中运行它们
db.getCollection('student').update(
{
"_id": ObjectId('5a377d62d21a3025a3c3aa49')
},
{
$set: {
"examples.$[i].isDeleted": true,
"examples.$[i].updatedAt": new Date(),
"updatedAt": new Date()
}
},
{
arrayFilters: [
{
"i._id": {
$in:[
ObjectId("5a377d62d21a3025a3c3aa4d"),
ObjectId("5a377d62d21a3025a3c3aa4c")
]
}
}
],
multi: true
}
)
https://docs.mongodb.com/manual/reference/operator/update/positional-filtered/
【问题讨论】:
标签: node.js mongodb mongoose array-filter