Get Started with MongoDB Atlas
On this page
MongoDB CLI provides a command-line interface for managing your MongoDB Atlas projects and clusters. This tutorial demonstrates how to:
Create one cluster in your Atlas project
Load sample data into your Atlas cluster
Add your IP address to your project's IP access list
Create a MongoDB user for your Atlas cluster
Connect to your new cluster using the MongoDB Shell,
mongosh
.
The reference pages for the commands mentioned in this tutorial are available in the MongoDB CLI Commands.
Prerequisites
Before you begin, you must complete the following:
Configure an Atlas Cluster
Use the mongocli atlas quickstart command to create an M0
cluster in Atlas.
You can run this command in the following ways:
Default Settings Mode - the command creates a sample shared cluster with the default settings.
Interactive mode - the command prompts you for the cluster settings and provides default values.
Noninteractive mode - you run the command with the options.
Click the tab to see the command for your preferred mode.
The command creates a sample shared-tier cluster with the following default settings:
ClusterName:
Quickstart-<number>
Cloud Provider:
AWS
Tier:
M0
Region:
US_EAST_1
Sample Data:
No
Database Username:
Quickstart-<number>
Database Password:
abcdef12345
MongoShell:
No
Note
The password is a random autogenerated value. abcdef12345
is an example value.
mongocli atlas quickstart --default --force
We are deploying Quickstart-9876543... Creating your cluster... [Its safe to 'Ctrl + C'] Loading sample data into your cluster... [Its safe to 'Ctrl + C'] Now you can connect to your Atlas cluster with: mongosh -u Quickstart-9876543 -p abcdef12345 mongodb+srv://quickstart-9876543.example.mongodb.net
The command prompts you for the cluster settings and provides
default options. Press Enter
when prompted to accept the
default settings.
mongocli atlas quickstart
The command creates a sample shared-tier cluster with the following settings:
Cluster name:
getStarted
Service provider:
AWS
Provider region:
US_EAST-1
Cluster tier:
M0
Disk size:
2
GBMongoDB version:
5.0
Replica set members:
3
mongocli atlas quickstart --clusterName getStarted --provider AWS --region US_EAST_1 --username testUser --password changeMe accessListIp <192.0.2.15> --skipSampleData Yes
Summary
Congratulations! You have successfully created a cluster to host your
data. You can connect to your cluster using the connection
string for
mongosh
or your application or view your cluster by logging
in to the UI.