suspend fun createIndex(key: Bson, options: IndexOptions = IndexOptions()): String
(source)
Creates an index.
key
- an object describing the index key(s), which may not be null.
options
- the options for the index
Return
a single element indicating when the operation has completed
Mongodb
.driver.manual reference/method/db.collection.ensureIndex Ensure Index
suspend fun createIndex(clientSession: ClientSession, key: Bson, options: IndexOptions = IndexOptions()): String
(source)
Creates an index.
clientSession
- the client session with which to associate this operation
key
- an object describing the index key(s), which may not be null.
options
- the options for the index
Return
a single element indicating when the operation has completed
Mongodb
.driver.manual reference/method/db.collection.ensureIndex Ensure Index
Mongodb
.server.release 3.6
Since
1.7
suspend fun createIndex(key: String, options: IndexOptions = IndexOptions()): String
(source)
Creates an index. If successful, the callback will be executed with the name of the created index as the result.
key
- an object describing the index key(s)
options
- the options for the index
Return
the index name