mongoosejs update

简介:
http://mongoosejs.com/docs/api.html#model_Model.update

Model.update = function update (conditions, doc, options, callback) {
  var mq = new Query({}, {}, this, this.collection);
  return mq.update(conditions, doc, options, callback);
};

Parameters:

 

Valid options:

  • safe (boolean) safe mode (defaults to value set in schema (true))
  • upsert (boolean) whether to create the doc if it doesn't match (false)
  • multi (boolean) whether multiple documents should be updated (false)
  • strict (boolean) overrides the strict option for this update
  • overwrite (boolean) disables update-only mode, allowing you to overwrite the doc (false)

C:\Users\admin\Documents\NetBeansProjects\mchat\public_html\node_modules\mongoose\model.js

可直接参考源码中的注释

相关文章
|
5月前
【开发专题_02】Executing an update/delete query
【开发专题_02】Executing an update/delete query
59 0
|
开发者 Python
Update 方法的使用 | 学习笔记
快速学习 Update 方法的使用
137 0
|
SQL druid Oracle
由for update引发的血案
公司的某些业务用到了数据库的悲观锁 for update,但有些同事没有把 for update 放在 Spring 事务中执行,在并发场景下发生了严重的线程阻塞问题,为了把这个问题吃透,秉承着老司机的职业素养,我决定要给同事们一个交代。
562 0
由for update引发的血案
|
SQL 关系型数据库 MySQL
Select for update使用详解
前言 近期开发与钱相关的项目,在高并发场景下对数据的准确行有很高的要求,用到了for update,故总结一波以便日后留恋。 for update的使用场景 如果遇到存在高并发并且对于数据的准确性很有要求的场景,是需要了解和使用for update的。 比如涉及到金钱、库存等。一般这些操作都是很长一串并且是开启事务的。如果库存刚开始读的时候是1,而立马另一个进程进行了update将库存更新为0了,而事务还没有结束,会将错的数据一直执行下去,就会有问题。所以需要for upate 进行数据加锁防止高并发时候数据出错。
2313 0
|
敏捷开发
Is It Time for Another IT Methodology Update?
Cloud computing starter packages can offer extraordinary value for money, but we need to Finance teams to work much more closely with IT teams.
2483 0
Is It Time for Another IT Methodology Update?
|
Web App开发 异构计算