- Indexes >
- Indexing Tutorials >
- Text Search Tutorials >
- Create
text
Index with Long Name
Create text
Index with Long Name¶
The default name for the index consists of each indexed field name
concatenated with _text
. For example, the following command creates
a text
index on the fields content
, users.comments
, and
users.profiles
:
The default name for the index is:
To avoid creating an index with a name that exceeds the index
name length limit
, you can pass the name
option to the db.collection.ensureIndex()
method:
Note
To drop the text
index, use the index name. To get the name of
an index, use db.collection.getIndexes()
.