Create, View, Update, and Delete Documents
You can use the Atlas UI to manage documents inside your collections. Documents are individual records in a MongoDB collection and are the basic unit of data in MongoDB.
Viewing documents and collections in the Atlas UI can provide a high-level overview of your database schema. You can use the Atlas UI to ensure you are following MongoDB's core data modeling concepts, such as utilizing embedded documents and arrays.
Required Roles
To insert, edit, or delete documents, you must have been granted access through one of the following roles:
Insert Documents
To add one or more documents to a collection through the Atlas UI, you can specify the document(s) to insert from scratch or you can clone an existing document and modify its fields and values as needed.
Insert One Document
Modify the document.
- To add a new field after an existing field, hover over the field and click on the plus sign that appears over the field's line number.
- To delete a field, hover over the field and click on the x sign
that appears to the left of the field's line number. You cannot
delete the
_id
field. - To edit a field name, value, or type, click on the field name, value, or type.
Insert Multiple Documents
Type or paste an array of documents to insert.
The following array of documents inserts three documents into the collection:
[ { "name": "Alice", "age": 26, "email": "alice@abc.com" }, { "name": "Bob", "age": 43, "email": "bob@def.com" }, { "name": "Carol", "age": 19, "email": "carol@xyz.com" } ]
Clone One Document
Optional. Specify a filter.
To specify filter condition, type in a query filter document in the filter bar. For example, to specify equality condition, use a filter document of the form:
{ <field1>: <value1>, ... }
To use query operators to specify a filter condition, use a filter document of the form:
{ <field1>: { <queryoperator>: <value1> }, ... }
Clone the document.
To clone a document displayed in the query results, hover over the document and click on its clone document icon.
The document editor appears with the _id
field with an
ObjectId value that reflects the time of its generation and
not the insertion time of the document. As such, the ObjectId
does not represent a strict insertion order.
Modify the document.
- To add a new field after an existing field, hover over the field and click on the plus sign that appears over the field's line number.
- To delete a field, hover over the field and click on the x sign
that appears to the left of the field's line number. You cannot
delete the
_id
field. - To edit a field name, value, or type, click on the field name, value, or type.
View Documents
From the Collections tab, you can view documents in a collection. To view documents for a collection:
Optional: Specify a query to find specific documents.
You can use the query bar to search for specific documents in your collection. You can specify one or more of the following in the query bar:
- A filter condition
- A project document to include and exclude specific fields in the results
- A sort order for the documents in the results
- A collation document for language specific rules.
As you type, the Apply button is disabled and the field name in the User Interface turns red until a valid query is entered.
Number of Documents Displayed per Page
The Atlas UI limits the total byte size of documents shown per page. As a result, you may see varying numbers of documents per page, especially if your documents vary significantly in size.
Edit One Document
To edit a document from a collection through the Atlas UI:
Optional. Specify a filter.
To specify filter condition, type in a query filter document in the filter bar. For example, to specify equality condition, use a filter document of the form:
{ <field1>: <value1>, ... }
To use query operators to specify a filter condition, use a filter document of the form:
{ <field1>: { <queryoperator>: <value1> }, ... }
Edit the document.
To edit a document displayed in the query results, hover over the document to edit and click on the pencil icon.
The document appears in the document editor:
- To add a new field, hover over the field and click on the plus sign that appears over the field's line number.
- To delete a field, hover over the field and click on the x sign
that appears to the left of the field's line number. You cannot
delete the
_id
field. - To edit a field name, value, or type, click on the field name, value, or type.
- To revert a specific change, hover over the edited field and click the revert icon that appears to the left of the field's line number.
Delete One Document
To delete a document from a collection through the Atlas UI:
Optional. Specify a filter.
To specify filter condition, type in a query filter document in the filter bar. For example, to specify equality condition, use a filter document of the form:
{ <field1>: <value1>, ... }
To use query operators to specify a filter condition, use a filter document of the form:
{ <field1>: { <queryoperator>: <value1> }, ... }