From the course: Next.js: Creating and Hosting a Full-Stack Site
Unlock this course with a free trial
Join today to access over 24,800 courses taught by industry experts.
Adding MongoDB to Next.js - React.js Tutorial
From the course: Next.js: Creating and Hosting a Full-Stack Site
Adding MongoDB to Next.js
- [Instructor] Alright, so now that we've set up a MongoDB Atlas project and created a cluster, it's time for us to connect our current Next.js application to this cluster so that we can store all of our product data, as well as our shopping cart data inside of it. So, here's what this is going to look like, we're going to click on Drivers here, and the nice thing about MongoDB Atlas is that it gives us a lot of information about how to connect to this cluster. So, we're going to want to use a lot of the suggestions that they give us. The first thing that we're going to want to do though is install the MongoDB driver into our Next.js application. And for that, you can simply copy and paste this command here, and we're going to go over to our project. And here, we'll just stop the project from running temporarily by saying Ctrl C. And then, we're going to run that command, npm install mongodb, and make sure that you're in your e-commerce folder when you do this. You should be able to…
Contents
-
-
-
-
-
(Locked)
What is MongoDB?1m 42s
-
(Locked)
Setting up hosting for MongoDB4m 54s
-
(Locked)
Adding MongoDB to Next.js6m 46s
-
(Locked)
Adding data to MongoDB7m 32s
-
(Locked)
Rewriting the list endpoints7m 29s
-
(Locked)
Rewriting the load product endpoint4m 2s
-
(Locked)
Rewriting the shopping cart endpoint5m 27s
-
(Locked)
Rewriting the add-to-cart endpoint5m 8s
-
(Locked)
Challenge: Rewriting the remove-from-cart endpoint57s
-
(Locked)
Solution: Rewriting the remove-from-cart endpoint4m 2s
-
(Locked)
-
-
-