将查询转换为节点。 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/ https://docs.mongodb.com/manual/reference/operator/update/positional-filtered/
根据发布MongoDB 3.6 注释
https://docs.mongodb.com/manual/release-notes/3.6/ https://docs.mongodb.com/manual/release-notes/3.6/
(@兼容驱动程序)要访问 mongodb 3.6 功能,需要使用节点驱动程序 3.x。
看来驱动器处于RC状态(截至此答案).
https://github.com/mongodb/node-mongodb-native/releases https://github.com/mongodb/node-mongodb-native/releases
因此,猫鼬可能仍在等待开始使用它。https://github.com/Automattic/mongoose/blob/master/package.json https://github.com/Automattic/mongoose/blob/master/package.json
所以你必须等到这些事情都安排好之后,当然你也可以尝试自己去接线,直到官方适配完成。
-- Update --
现在效果很好。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)