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);
};
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 thestrict
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
可直接参考源码中的注释
相关推荐
猫鼬时间戳插件 对于简单的插件这增加createdAt和updatedAt日期属性是那些获得自动分配到最近创建/更新时间戳。安装npm install mongoose-timestamp 用法var timestamps = require ( 'mongoose-timestamp' ) ;...
本教程“node-Mongodb-CURD-:node+Mongodb增删改查小栗子”主要涉及如何使用Node.js和Mongoose进行MongoDB的基本CRUD(创建Create、读取Read、更新Update、删除Delete)操作。下面将详细介绍这些操作: 1. 创建...
3. **更新文档**:`db.<collection>.updateOne({query}, {update})`,例如`db.users.updateOne({name: "John"}, {$set: {age: 30}})`。 4. **删除文档**:`db.<collection>.deleteOne({query})`或`db.<collection>....
4. `mongoose`:基于MongooseJS的ODM(对象数据模型),提供了一种面向对象的方式来操作MongoDB,简化了数据库操作。 5. `expressjs`:可能是一个别名,指代`express`框架。 6. `Mongoose`:同上,可能是指Mongoose...
- **更新(Update)**:用户可以修改已有数据,如编辑个人资料或更新产品信息。 - **删除(Delete)**:用户可以移除数据,如取消订阅或删除订单。 6. **应用实现**: 使用Node.js和Express,开发者可以快速搭建...