This document provides instructions for installing MongoDB on Windows and macOS, as well as connecting to a MongoDB database hosted on MongoDB Atlas. It describes downloading and running MongoDB as a service, installing MongoDB Compass as a GUI, and connecting to a MongoDB database on Atlas from the MongoDB Shell by copying a provided connection string.
This document provides instructions for installing MongoDB on Windows and macOS, as well as connecting to a MongoDB database hosted on MongoDB Atlas. It describes downloading and running MongoDB as a service, installing MongoDB Compass as a GUI, and connecting to a MongoDB database on Atlas from the MongoDB Shell by copying a provided connection string.
This document provides instructions for installing MongoDB on Windows and macOS, as well as connecting to a MongoDB database hosted on MongoDB Atlas. It describes downloading and running MongoDB as a service, installing MongoDB Compass as a GUI, and connecting to a MongoDB database on Atlas from the MongoDB Shell by copying a provided connection string.
Install and run the MongoDB Community Edition on your computer.
For Windows: • follow this instruction to install MongoDB. • run MongoDB as a Windows service by typing the following line at the command interpreter with admin privilege: "C:\Program Files\MongoDB\Server\4.4\bin\mongo.exe"
For macOS:
• follow this instruction to install homebrew.
• install MongoDB by typing the following lines at the terminal:
brew tap mongodb/brew
brew install mongodb-community@4.4
• run MongoDB as a macOS service by typing the following line
at the terminal:
brew services start mongodb-community@4.4
Install MongoDB Compass
Follow this link to install Mongo Compass, which is a GUI for MongoDB and can be used to visually explore the database. The following video gives a demo on how to use Compass to explore a MongoDB database.
Refer to this YouTube tutorial for assistance in installing MongoDB on
your system. MongoDB Atlas:
Go to: https://www.mongodb.com/cloud/atlas/register
• Create an account and sign in
• Now this will land you to the MongoDB Atlas home page where you need to create a new cluster • Click on Build a cluster • Shared Clusters is good enough for development. • You can update it at any time. So, use that one. • Click Create a cluster. Once the cluster is created,we can add database users. Now you need to add a network for the cluster. So, we will click on Network Access. Then click on Add IP Addresses.
You can add your current IP which is more secure, or you can allow access from anywhere.
• Click ALLOW ACCESS FROM ANYWHERE
• Click Confirm • It takes some time to create the IP address and you can see the status. • Now go to Clusters and Clink on CONNECT. Now you will be able to see the following options:
• Connect with Mongo Shell
• Connect with Your Application • Connect with Mongo DB Compass We will select Connect with MongoDB Shell
As we have already worked in the Shell, we already have it
installed. • Select I have the mongo Shell Installed • Copy the String in Step 2 and read the directions in that step. • Next, you will be opening the MongoDB shell and running the copied string, changing the <dname> to test. •mongodb+srv://rsanda1:<password>@test.jvyzmao.mongodb. net/ Open up the MongoDB shell, as you did earlier.
• Check the MongoDB version by running the below command:
mongo –version • This will show the version of your MongoDB • Now paste the copied link and run • After the command you will be in the cloud.
Now create a test database named test1
• Create a collection named testCollection • Insert a row in the testCollection as testCollection one Now if we check on Atlas, we can see the database and the collection we created using Shell. Additional resource: