📌  相关文章
📜  添加多个子文档 mongoose - Shell-Bash 代码示例

📅  最后修改于: 2022-03-11 14:50:49.400000             🧑  作者: Mango

代码示例1
#not duplicate value
db.getCollection('profilesservices').updateOne({_id: ObjectId("603ce3bf9323e811c86cb7c8")}, {
 $addToSet: {"jobPreferences.jobInterests": {$each: ["mobile developer", "backend developer"]} }    
})

# with duplicate value
db.getCollection('profilesservices').updateOne({_id: ObjectId("603ce3bf9323e811c86cb7c8")}, {
 $push: {"jobPreferences.jobInterests": {$each: ["mobile developer", "backend developer"]} }    
})