DBAtlas · Database operations atlas

Create an index (non-blocking)

MongoDBMaintenance

Command

db.customer.createIndex({ email: 1 }, { name: "idx_email" })

What it does

Creates an index on the specified field; since MongoDB 4.2, index builds do not block writes by default.

When to use it

When adding a new index to improve query performance.

Caution

On large collections, index builds consume CPU and IO; load on the primary can increase.

Open in DBAtlas →

Related