The goals for the project are
-
Get Data
-
Post Data
- POST with Body Parser
- Testing with Postman
- Saving data
-
Updating Data
- Implementing PUT
- Middleware
- Implementing PATCH
- Node.js
- Express
- Nodemon
- Eslint
- Postman
When using Windows, an important part to understand handling MongoDB is how to include the MongoDB binaries to the environment variables.
The procedure is explained on the installation guide but an interesting explanation on the legacy command 'mongo' is found here and was very useful in the development the project.
We create and populante the bookAPI database used on the project by doing mongosh bookAPI booksJson.js. To check it, we can enter mongosh and execute in the terminal
show dbs
use bookAPIAfter that, we have switched to the bookAPI, we can see the collections using show collections and display the contents of it using db.books.find()
Important entries to understand the commands used are the Databases and Collections, listCollections and Collection Methods pages from MongoDB docs.
According to a MongoDB developer article "Mongoose is a Node. js-based Object Data Modeling (ODM) library for MongoDB. It is akin to an Object Relational Mapper (ORM) such as SQLAlchemy for traditional SQL databases". So it is necessary to have MongoDB and Node.js installed.
It was used to created the Book model through the Schema defining the shape of the documents within the MongoDB collection.
An important page to understand the methods used throught the project as well as other data query possibilities is the Model page, with methods like create, find, findById, save, delete methods and many more.