Getting ready

In this recipe, we will see how three of these types of middleware functions work in Mongoose:

  • Document middleware
  • Model middleware
  • Query middleware

First, ensure that you have MongoDB installed and it's running. As an alternative, if you prefer, a MongoDB DBaaS instance in the cloud will also do. Before you start, create a new package.json file with the following code:

      { 
        "dependencies": { 
          "mongoose": "5.0.11" 
        } 
      } 

Then, install the dependencies by opening a Terminal and running:

      npm install
..................Content has been hidden....................

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