In this task we will introduce Mongoose. Mongoose is an Object Data Modeling (ODM) library for MongoDB and Node.js. It manages relationships between data, provides schema validation, and is used to translate between objects in code and the representation of those objects in MongoDB. We will learn how to setup Mongoose and how to connect it with our app. We will create our user models and schemas and define exactly how a record/user/order object will look. The next step will be to create a feed function that will feed our database with some fake data so we will be able to test all our endpoints straight away after initialising our server.
TODO:
- Please set up mongoose in your server.
- Create a data schema and a model for our records, users and orders.
- Write a seed script using chance that will run everytime we start our project. If the database is empty, it will feed it some records, orders and users.