createIndex

suspend fun createIndex(keys: Bson, options: IndexOptions = IndexOptions()): String

Create an index with the given keys and options.

Return

the index name

Parameters

keys

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

options

the options for the index

See also


suspend fun createIndex(clientSession: ClientSession, keys: Bson, options: IndexOptions = IndexOptions()): String

Create an index with the given keys and options.

Return

the index name

Parameters

clientSession

the client session with which to associate this operation

keys

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

options

the options for the index

See also