collection.update
Modifies an existing document or documents in a collection. The method can modify specific fields of an existing document or documents or replace an existing document entirely, depending on the update parameter. By default, the update() method updates a single document. Set the multi option to update all documents that match the query criteria.
Arguments
query(String|ObjectId|Object)update(Object): Update operations to be performed on the document[
options] (Object)
if options.replaceOne is true, it will work like replaceOne.
- [
callback] (function)
Returns
A promise.
Example
users.update({name: 'foo'}, {name: 'bar'})