Docs Menu

Docs HomeMongoDB Compass

Create a Clustered Collection

On this page

  • Restrictions
  • Steps
  • Next Steps

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

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.

Create New Collection
click to enlarge
2
3

From the Advanced Collection Options drop-down, select Clustered Collections.

4

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

5

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.

6

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

←  Create a Collection with CollationCreate a Collection with Queryable Encryption →