Updating Documents by Using Mongoose

There are several methods for updating documents when using Mongoose. Which one you use depends on the nature of your application. One method is simply to call the save() function described in the previous section. You can call the save() method on objects already created in the database.

The other method is to use update() on either the Document object for a single update or on the Model object to update multiple documents in the model. The advantages of the update() methods are that it can be applied to multiple objects, and it provides slightly better performance. The following sections describe these methods.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.139.103.122