MongoDB provides several ways to create databases and collections for your Atlas clusters. You can create databases and collections in the following ways;
Directly from the Atlas UI with the Data Explorer
Connecting to your cluster via the mongo shell and using MongoDB CRUD operations
Connecting to your cluster via an application with a MongoDB driver
Connecting to your cluster via the MongoDB Compass tool
1. To create databases and collections directly from the Atlas UI with the Data Explorer
Click COLLECTIONS on your clusters view
Hit “+ Create Database” and enter the database and collection names
Insert documents from the Atlas UI with the INSERT DOCUMENT button to add to your collection
2. To connect to your cluster via the Mongo Shell using MongoDB CRUD operations
Click CONNECT on your clusters view and Download and install the mongo shell
Select “Connect with the Mongo Shell” and Copy the connection URL
Paste the URL into your command line, connecting to your cluster and automatically creating a test database
Inserting a document with db.collection.insertOne() command automatically creates a new collection or adds a document to an existing collection
3. To connect your application to your cluster via a MongoDB driver
Click CONNECT on your clusters view
Select “Connect your Application” and Copy the connection string
Paste the connection string into your application and connect to your cluster to automatically create a test database
Inserting a Document from for your application via a MongoDB Driver automatically creates a new collection or adds a document to an existing collection
4. To connect to your cluster via MongoDB Compass
Click CONNECT on your clusters view
Select “Connect with MongoDB Compass” and Copy the connection URL to the clipboard
Open Compass and allow the fields to be populated from the clipboard
Hit CREATE DATABASE to create databases and collections and INSERT DOCUMENT to insert documents from the Compass UI
Note: Before connecting to your Atlas cluster, please ensure you add your IP whitelist entry to your project's IP whitelist and configure your MongoDB user with access to the desired database(s) on the cluster.
To troubleshoot connection issues, see Troubleshooting Connection Issues.