CNode

关于node-mongodb的参数

Bbluedream发布于12 年前最后回复11 年前2 回复4634 浏览0 收藏
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

查看回复

回复 (2)

参与回复
登录后即可参与回复。登录