How does Mongoose's save callback work? How does Mongoose's save callback work? mongoose mongoose

How does Mongoose's save callback work?


The save function's callback will accept three arguments :

  • The error
  • The document that was saved
  • The number of rows affected

The arguments are listed here

Note that the second argument, the document, must be the same document that is calling the save

You can name the arguments however you want, you're not casting it to an object or anything like that. It's simply a name that you want to use to refer it to in your function's body.