April 2020
Intermediate to advanced
716 pages
18h 55m
English
We will implement a Mongoose model to define an Expense model for storing the details of each expense record. This model will be defined in server/models/expense.model.js, and the implementation will be similar to other Mongoose Model implementations covered in previous chapters, such as the Course model defined in Chapter 6, Building a Web-Based Classroom Application. The Expense schema in this model will have simple fields to store details about each expense, such as a title, the amount, category, and date when it was incurred, along with a reference to the user who created the record. The code defining the expense fields are given in the following list with explanations:
Read now
Unlock full access