-
Notifications
You must be signed in to change notification settings - Fork 4
How to install MongoDB
Aasher Kataria edited this page Nov 17, 2022
·
1 revision
When running npm run dev
you might notice this error pop-up:
This means that you do not have a .env
file configured along with MongoDB
Simply create a new file and name it .env
It should automatically be greyed out and not included in any future commits/pushes.
-
Go to Mongo Atlas and create a new account.
-
Create a Shared Cluster:
- Choose AWS, Oregon, (us-west2)
- Change the cluster name to textbook-marketplace
- Create a su (super user)
- Select My Local Environment under Where would you like to connect from?
- Allow access from anywhere
add the IP address 0.0.0.0/0
to your Access list
- Click Connect
- Connect using MongoDB Compass
- Download MongoDB Compass and paste the server link under a New Connection and hit Connect
-
Copy the same server address to a new variable in your
.env
file under the nameMONGODB_URI=
-
Replace with the password you assigned in your cluster for your super user.
- Run
npm run dev
, and you will now be connected to your mongodb cluster