关于node-mongodb的参数
collection.update(criteria, objNew, options, [callback]);
Useful options:
-
safe:true Should always set if you have a callback.
-
multi:true If set, all matching documents are updated, not just the first.
-
upsert:true Atomically inserts the document if no documents matched.
db.collection('test').update({hi: 'here'}, {$set: {hi: 'there'}}, {w:1},
function(err) {
if (err) console.warn(err.message);
else console.log('successfully updated');
});
README文档里给的是safe multi upsert这几个选项。 但这个{w:1}是啥意思,哪里能看到相关文档说明?
地址: node-mongodb