Mongoose is an object data modeling library (ODM) that allows you to define schemas for your data collections. You can find out more about Mongoose on the project website: http://mongoosejs.com/.
To connect to a MongoDB instance using the
mongoose variable, we first need to install npm and save Mongoose. The
save flag automatically adds the module to your
package.json with the latest version, thus, it is always recommended to install your modules with the save flag. For modules that you only need locally (for example, Mocha), you can use the
For this project, we create a new file
/src/lib/db.js, which requires Mongoose. The local connection to the
mongodb database is made in