kmongo / org.litote.kmongo / com.mongodb.client.MongoCollection / createIndex

createIndex

fun <T> MongoCollection<T>.createIndex(keys: String, indexOptions: IndexOptions = IndexOptions()): String (source)

Create an index with the given keys and options.

Parameters

keys - an object describing the index key(s), which may not be null.

indexOptions - the options for the index

Return
the index name

fun <T> MongoCollection<T>.createIndex(clientSession: ClientSession, keys: String, indexOptions: IndexOptions = IndexOptions()): String (source)

Create an index with the given keys and options.

Parameters

clientSession - the client session with which to associate this operation

keys - an object describing the index key(s), which may not be null.

indexOptions - the options for the index

Return
the index name