Make the MongoDB docs better! We value your opinion. Share your feedback for a chance to win $100.
MongoDB Branding Shape
Click here >
Docs Menu

Create a Clustered Collection

Clustered collections are collections with a clustered index. Clustered collections store documents ordered by clustered index key value. You can use clustered collections when only one clustered index is necessary.

Clustered collection limitations:

  • The clustered index key must be on the _id field.

  • Clustered collections may not be capped collections.

1
  1. If it's not already displayed, select the organization that contains your project from the Organizations menu in the navigation bar.

  2. If it's not already displayed, select your project from the Projects menu in the navigation bar.

  3. In the sidebar, click Data Explorer under the Database heading.

    The Data Explorer displays.

IMPORTANT: You can also click the name of a cluster to open the Cluster sidebar, and then click Data Explorer under the Shortcuts heading.

2

Select a database and from the Collections screen, click the Create Collection button.

You can also click the + next to the name of the database you select to open the Create Collection dialog box.

3
4

From the Additional preferences drop-down, select Clustered Collections.

5

You can enter a name for the clustered index or use the automatically generated name.

6

The expireAfterSeconds field is a TTL index that enables automatic deletion of documents older than the specified number of seconds. The expireAfterSeconds field must be a positive, non-zero value.

7

In the Collections screen, your new collection is marked by a Clustered badge next to the collection name.