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

createIndex

fun <T> MongoCollection<T>.createIndex(key: String, options: IndexOptions = IndexOptions()): Maybe<String> (source)

Creates an index. If successful, the callback will be executed with the name of the created index as the result.

Parameters

key - an object describing the index key(s)

options - the options for the index

Return
the index name

fun <T> MongoCollection<T>.createIndex(clientSession: ClientSession, key: String, options: IndexOptions = IndexOptions()): Maybe<String> (source)

Creates an index. If successful, the callback will be executed with the name of the created index as the result.

Parameters

clientSession - the client session

key - an object describing the index key(s)

options - the options for the index

Return
the index name