Docs Menu

Docs HomeLaunch & Manage MongoDBMongoDB CLI

mongocli ops-manager clusters indexes create

On this page

  • Syntax
  • Arguments
  • Options
  • Inherited Options
  • Examples

Create a rolling index for your MongoDB cluster.

Command Syntax
mongocli ops-manager clusters indexes create [indexName] [options]
Name
Type
Required
Description
indexName
string
false
Name of the index to create.
Name
Type
Required
Description
--MaxVariable
string
false
Flag that determines which characters to ignore. This flag applies only if you set indexConfigs.collation.alternate to shifted.
--alternate
string
false
Flag that determines whether collation should consider whitespace and punctuation as base characters during comparisons.
--backwards
false
Flag that indicates whether strings with diacritics sort from the back to the front of the string.
--caseFirst
string
false
Flag that determines the sort order of case differences during tertiary level comparisons.
--caseLevel
false
Flag that enables index case comparison. This flag applies only if the strength level is set to 1 or 2.
--collectionName
string
true
Name of the collection.
--db
string
true
Name of the database.
-h, --help
false
help for create
--key
strings
true
Field to be indexed and the type of index in the following format: field:type.
--locale
string
false
Locale that the ICU defines.
--normalization
false
Flag that indicates whether collation checks if text requires normalization and performs normalization to compare text.
--numericOrdering
false
Flag that indicates that collation compares numeric strings as numbers. If you set to false, collation compares numeric strings as strings.
--projectId
string
false
Hexadecimal string that identifies the project to use. This option overrides the settings in the configuration file or environment variable.
--rsName
string
true
Replica set that the index is built on.
--sparse
false
Flag that creates a sparse index. To learn more, see https://dochub.mongodb.org/core/index-sparse-manual.
--strength
int
false
Level of comparison to perform.
Name
Type
Required
Description
-P, --profile
string
false
Name of the profile to use from your configuration file. To learn about profiles for MongoCLI, see https://dochub.mongodb.org/core/atlas-cli-configuration-file.
# Create an index named bedrooms_1 on the listings collection of the realestate database on the replica set repl1.
The command uses the default profile.
mongocli om clusters indexes create bedrooms_1 \
--collectionName listings --db realestate --key bedrooms:1 \
--rsName repl1
←  mongocli ops-manager clusters indexesmongocli ops-manager clusters list →