Navigation

Manage Indexes

Available only with Cloud Manager Premium

This feature is available only with Cloud Manager Premium, which comes with certain MongoDB subscriptions. For more information, Contact MongoDB.

Cloud Manager Automation lets you build MongoDB indexes without downtime for your deployment. The Automation Agent will sequentially take each individual node in a replica set or cluster offline to build the indexes. The agent builds the indexes without increasing load on your deployment or blocking read or write operations. You can create any type of MongoDB index. For available types, see Index Types in the MongoDB manual.

Note

For replica sets with one data-bearing node or less than three total nodes, Cloud Manager builds the index in the foreground without taking the cluster offline.

Create a Managed Index

You can create two types of indexes:

Standard Index An index on one or more fields of any of the types described in the MongoDB manual.
TTL Index

A single-field index that MongoDB can use to automatically remove documents from a database that stores transient information, such as logs.

See also

To learn more about TTL Indexes, see the MongoDB manual.

1

Click Deployment, then the Processes tab, then the Topology view.

2

On the line for the sharded cluster or replica set, click Modify.

3

Scroll to, then expand the Index Configuration section.

4

From the Add menu, click Index.

5

Configure the index.

Set the following options:

Database and Collection Specify the database and the collection to which the index applies.
Field

Specify the field to index.

You can specify multiple fields using the add another link. If you use more than one field to create an index, this resulting index is called a Compound Index. The order of the fields in a Compound Index is important.

See also

To learn more, see Compound Indexes in the MongoDB manual.

Value

Specifies either the sort order or index type.

Accepted values are:

Unique

Click this box to ensure this values in this indexed field are unique across the collection. The index rejects documents that contain an existing value in the indexed field or fields.

See also

To learn more, see the Unique Indexes in the MongoDB manual.

Sparse

Click this box if the index should skip any document that is missing the indexed field.

See also

To learn more, see the Sparse Indexes in the MongoDB manual.

2d min/max Specify the coordinates for a 2d. Appears only when the Value is 2d or 2d Sphere
bucketSize Specify the size of the buckets for a geoHaystack index. Appears only when the Value is Geospatial.
6

(Optional) Configure collation options.

The collation options let you specify the language-specific rules to use when sorting and matching strings.

  1. Click + show collation options.

  2. Set the Locale.

    Locale is the ICU Locale code that MongoDB supports for local languages.

    • To learn more about the specific collation options, see Collation in the MongoDB manual.
    • To learn which collation options are enabled by default for each local, see Collation Locales and Default Values in the MongoDB Manual.
7

Click Add.

8

Click Save to apply this change to the deployment.

9

Click Review & Deploy to review your changes.

10

Review and approve your changes.

Cloud Manager displays your proposed changes.

  1. If you are satisfied, click Confirm & Deploy.
  2. If you want to make further configuration changes, click Cancel. Click Modify for the cluster to make additional changes.
1

Click Deployment, then the Processes tab, then the Topology view.

2

On the line for the sharded cluster or replica set, click Modify.

3

Scroll to, then expand the Index Configuration section.

4

From the Add menu, click TTL Index.

5

Configure the TTL index.

Enter the following information:

Database and Collection The collection to which the index applies. Specify both the database and the collection.
Field

The field to index.

You must specify a data field. TTL indexes expire documents after the specified number of seconds has passed since the indexed field value.

Expiration For a TTL index, the number of seconds to wait after the date specified in the indexed field before removing the document. The expiration time is the field value plus the specified number of seconds.
6

Click Add.

7

Click Save to apply this change to the deployment.

8

Click Review & Deploy to review your changes.

9

Review and approve your changes.

Cloud Manager displays your proposed changes.

  1. If you are satisfied, click Confirm & Deploy.
  2. If you want to make further configuration changes, click Cancel. Click Modify for the cluster to make additional changes.

Note

MongoDB backups automatically include any indexes you create using Cloud Manager.

Remove an Index

Important

The Automation Agent does not currently support automated removal of an index from a collection. To remove an index that Automation manages, first remove the index from Automation and then manually remove the index from the collection.

1

Click Deployment, then the Processes tab, then the Topology view.

2

On the line listing the deployment item, click Modify.

A deployment item can be a sharded cluster or replica set.

3

Scroll to, then expand the Index Configuration section.

4

For the selected index, click Unmanage.

5

Click Save to apply this change to the deployment.

6

Click Review & Deploy to review your changes.

7

Review and approve your changes.

Cloud Manager displays your proposed changes.

  1. If you are satisfied, click Confirm & Deploy.
  2. If you want to make further configuration changes, click Cancel. Click Modify for the cluster to make additional changes.
8

Manually remove the index.

Manually remove the index as described in Remove Indexes in the MongoDB manual.