June 2014
Intermediate to advanced
696 pages
38h 52m
English
The Model object provides an update() method that allows you to update multiple documents in a collection by using the update operators described in Table 14.2. The syntax for the update() method on Model objects is shown below:
update(query, update, [options], [callback])
The query parameter defines the query used to identify which objects to update. The update parameter is an object that defines the update operation to perform on the document. The options parameter specifies the write preferences, and the callback parameter accepts an error as the first argument and the number of documents updated as the second.
A nice thing about updating at the model level is that you can use the ...
Read now
Unlock full access