You can manage databases and collections on the Atlas cluster from the Atlas UI,Documentation Index
Fetch the complete documentation index at: https://mongodb-preview.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
mongosh, or MongoDB Compass. This page describes how to manage databases and collections on the Atlas cluster from the Atlas UI. For self-managed deployments, you can use mongosh or MongoDB Compass to manage databases and collections.
Select the client that you want to use to manage databases and collections.
- Atlas UI
- mongosh
- MongoDB Compass
MongoDB Atlas is a multi-cloud database service that simplifies deploying and managing your databases on the cloud providers of your choice.
Databases
In MongoDB, databases hold one or more collections of documents.- Atlas UI
- mongosh
- MongoDB Compass
To select a database to use, log in to Atlas and go to the Data Explorer page for your project.
Select your organization and project
- If it’s not already displayed, select the organization that contains your project from the Organizations menu in the navigation bar.
- If it’s not already displayed, select your project from the Projects menu in the navigation bar.
Open the Data Explorer
In the sidebar, click Data Explorer under the Database heading.The Data Explorer displays.Create a Database
- Atlas UI
- mongosh
- MongoDB Compass
To create a new database in Atlas, perform the following steps:
If it’s not already displayed, select the organization that contains your project from the Organizations menu in the navigation bar. Select your project from the Projects menu. In the sidebar, click Data Explorer under the Database heading. The Data Explorer displays.
In the Connections sidebar, select or hover over your cluster and click the icon to open the Create Database dialog box.
Enter the Database Name and the Collection NameEnter the Database Name and the Collection Name to create the database and its first collection.If you want to use custom collation on the collection, select the Use Custom Collation checkbox and select the desired collation settings.
Select whether the collection is a time series collection. If you select to create a time series collection, specify the time field and granularity. You can optionally specify the meta field and the time for old data in the collection to expire.
Collections
MongoDB stores documents in collections. Collections are analogous to tables in relational databases.Create a Collection
If a collection does not exist, MongoDB creates the collection when you first store data for that collection.- Atlas
- mongosh
- MongoDB Compass
To create a new collection in Atlas, perform the following steps:
If it’s not already displayed, select the organization that contains your project from the Organizations menu in the navigation bar. Select your project from the Projects menu. In the sidebar, click Data Explorer under the Database heading. The Data Explorer displays.
In the Create Collection dialog box, enter the name of the collection you want to create.Atlas also provides Additional preferences. You can choose from the following options:
Select whether the collection is a time series collection. If you select to create a time series collection, specify the time field and granularity. You can optionally specify the meta field and the time for old data in the collection to expire.
- Atlas
- mongosh
- MongoDB Compass
Schema Validation
By default, a collection does not require its documents to have the same schema; i.e. the documents in a single collection do not need to have the same set of fields and the data type for a field can differ across documents within a collection. However, you can enforce schema validation rules for a collection during update and insert operations. See Schema Validation for details. For deployments hosted in MongoDB Atlas, the Performance Advisor and the MongoDB Atlas UI detect common schema design issues and suggest modifications that follow MongoDB best practices. To learn more, see Schema Suggestions.Modifying Document Structure
To change the structure of the documents in a collection, such as add new fields, remove existing fields, or change the field values to a new type, update the documents to the new structure.Unique Identifiers
Collections are assigned an immutable UUID (Universally unique identifier). The collection UUID remains the same across all members of a replica set and shards in a sharded cluster.- Atlas
- mongosh
- MongoDB Compass