Fix/make mongodb instructions accurate (#39214)
* fix: make mongodb instructions accurate
This commit is contained in:
@ -3,6 +3,7 @@ title: Introduction to the MongoDB and Mongoose Challenges
|
|||||||
block: MongoDB and Mongoose
|
block: MongoDB and Mongoose
|
||||||
superBlock: APIs and Microservices
|
superBlock: APIs and Microservices
|
||||||
---
|
---
|
||||||
|
|
||||||
## Introduction to the MongoDB and Mongoose Challenges
|
## Introduction to the MongoDB and Mongoose Challenges
|
||||||
|
|
||||||
MongoDB is a database that stores data records (documents) for use by an application. Mongo is a non-relational, "NoSQL" database. This means Mongo stores all associated data within one record, instead of storing it across many preset tables as in a SQL database. Some benefits of this storage model are:
|
MongoDB is a database that stores data records (documents) for use by an application. Mongo is a non-relational, "NoSQL" database. This means Mongo stores all associated data within one record, instead of storing it across many preset tables as in a SQL database. Some benefits of this storage model are:
|
||||||
@ -49,19 +50,14 @@ Once you open the MongoDB Atlas page, you should sign up for a new account.
|
|||||||
- **Choose your cloud provider and region**, you can leave this as the default provided (typically AWS).
|
- **Choose your cloud provider and region**, you can leave this as the default provided (typically AWS).
|
||||||
- **Customize your cluster's specs**, you can also leave this as the default provided, `M0 Sandbox (Shared RAM, 512 MB Storage) Encrypted`.
|
- **Customize your cluster's specs**, you can also leave this as the default provided, `M0 Sandbox (Shared RAM, 512 MB Storage) Encrypted`.
|
||||||
- **Give your cluster a name**, you can also leave this as the default provided, `Cluster 0`.
|
- **Give your cluster a name**, you can also leave this as the default provided, `Cluster 0`.
|
||||||
- Now click the green **Create Cluster** button at the bottom of the screen and verify the image captions they provide.
|
- Now click the green **Create Cluster** button at the bottom of the screen and verify the image captions they provide.
|
||||||
- You should now see the message, `Your cluster is being created -
|
- You should now see the message `Your cluster is being created - New clusters take between 7-10 minutes to provision.` Wait until the cluster is created before going to the next step.
|
||||||
New clusters take between 7-10 minutes to provision.` Wait until the cluster is created before going to the next step.
|
|
||||||
|
|
||||||
### Create a new user on the database
|
### Create a new user on the database
|
||||||
|
|
||||||
- You should be able to see the green **Get Started** button on the bottom left of your screen, you can click this button to see at which step of the process your are in, if you click on it now, you can see the next step is to **Create your first database user**, go ahead and click on that step.
|
- On the left side of your screen click the **Database Access** button under **Security** to start creating a new user.
|
||||||
- Follow the instructions by clicking on the `Security` tab.
|
- Click the **Add New Database User** button that is displayed in the next menu.
|
||||||
- Click on the green **ADD NEW USER** button.
|
- Enter a new username and password. You can set the privileges to **Read and write to any database** if they are not already. Then click **Add User** to finish creating the user.
|
||||||
- Enter a user name and password and then select **Read or write to any database** under user privileges, remember to store your username and password somewhere safe.
|
|
||||||
- Click on the **ADD USER** green button in the bottom right of the modal.
|
|
||||||
|
|
||||||
Note: You can always upgrade your privileges to the **Admin** level, however, it is best practice to give permissions to a user on an as-needed basis for security reasons.
|
|
||||||
|
|
||||||
### Whitelist your IP address
|
### Whitelist your IP address
|
||||||
|
|
||||||
@ -73,9 +69,10 @@ Note: You can always upgrade your privileges to the **Admin** level, however, it
|
|||||||
### Connect to your cluster
|
### Connect to your cluster
|
||||||
|
|
||||||
- Clicking on the green **Get Started** button in the bottom left of your screen should now show you the final step, **Connect to your cluster**, click on it.
|
- Clicking on the green **Get Started** button in the bottom left of your screen should now show you the final step, **Connect to your cluster**, click on it.
|
||||||
|
|
||||||
- Follow the instructions by clicking on the `Connect` button in the `Sandbox` section.
|
- Follow the instructions by clicking on the `Connect` button in the `Sandbox` section.
|
||||||
- In the pop-up modal, click on **Connect Your Application**, a connection string will be displayed, you can copy that connection string by clicking on the `copy` button.
|
- In the pop-up modal, click on **Connect Your Application**, a connection string will be displayed, you can copy that connection string by clicking on the `copy` button.
|
||||||
- This will be the final URI that you will use to connect to your db, it will look something like this `mongodb+srv://<user>:<password>@<cluster#-dbname>.mongodb.net/test?retryWrites=true`, notice that the `user` and `cluster#-dbname` fields are already filled out for you, all you would need to replace is the `password` field with the one that you created in the previous step.
|
- This will be the final URI that you will use to connect to your db and will look something like `mongodb+srv://<user>:<password>@<cluster#-dbname>.mongodb.net/test?retryWrites=true`. Notice that the `user` and `cluster#-dbname` fields are already filled out for you, so all you would need to replace is the `password` field with the one that you created in the previous step.
|
||||||
|
|
||||||
- That's it! You now have the URI you will add to your application to connect to your database. Keep this URI safe somewhere, so you can use it later!
|
- That's it! You now have the URI you will add to your application to connect to your database. Keep this URI safe somewhere, so you can use it later!
|
||||||
- Feel free to create separate databases for different applications if they need a separate database. You just need to create a new project under your current MongoDB Atlas account, build a new cluster, add a new user, whitelist your IP addresses and finally connect to your cluster to obtain the new URI.
|
- Feel free to create separate databases for different applications if they need a separate database. You just need to create a new project under your current MongoDB Atlas account, build a new cluster, add a new user, whitelist your IP addresses and finally connect to your cluster to obtain the new URI.
|
||||||
|
Reference in New Issue
Block a user