📜  $set - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:52.380000             🧑  作者: Mango

代码示例1
// https://mongodb.github.io/node-mongodb-native/markdown-docs/insert.html

//To update only selected fields, $set operator needs to be used. Following replacement object replaces author value but leaves everything else intact.

collection.update({_id:"123"}, {$set: {author:"Jessica"}});