Chapter 7. Interacting with Data – Updating

In the previous chapter, we've seen how to put data in and read it back out. It's time to see how to change the existing data. In this chapter, we will look at the three built-in static model methods that help us update in one command, and the instance method we can use to save a document following a find operation.

By the end of this chapter, you will have a good understanding of how to use the different approaches, and which one is appropriate to different scenarios. You will also have added the ability to make edits to the logged in user, update a project's information, and log the last time a user logged in.

Model helper methods

There are three static methods for updating data in a single go:

  • update() ...

Get Mongoose for Application Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.