From the course: Mastering Nest.js: Build Scalable Applications with Mastery in Nest.js Framework

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Connecting MyStore with MongoDB database

Connecting MyStore with MongoDB database

Alright, so after learning how the nest application interacts with the MongoDB database, we are now going to switch the my store app from MySQL to MongoDB database. We are going to use the mongoose as a core driver to interact with the MongoDB and we will use the dedicated session store available for MongoDB to create the store sessions. In this section, I'll show you how to make a smooth transition from an RDBMS database to a NoSQL database without disturbing the flow of the application. So follow along with me. First we will install the nestjs mongoos and the core mongoos package by giving the command npm install-save mongoos nestjs-mongoos. Next I'll open the MongoDB compass and make a connection. Then I'll create a database. I'll name it as my store MongoDB and create a temporary collection. I'll copy the connection string. Now back to the VS code, I'll open the app module file. Here we have defined the type ORM for interacting with MySQL. I'll simply remove the entire type ORM…

Contents