suspend fun ensureIndex(keys: String, indexOptions: IndexOptions = IndexOptions()): String?
(source)suspend fun ensureIndex(keys: Bson, indexOptions: IndexOptions = IndexOptions()): String?
(source)
Create an index with the given keys and options. If the creation of the index is not doable because an index with the same keys but with different IndexOptions already exists, then drop the existing index and create a new one.
keys
- an object describing the index key(s)
indexOptions
- the options for the index
Return
the index name
suspend fun ensureIndex(vararg properties: KProperty<*>, indexOptions: IndexOptions = IndexOptions()): String?
(source)
Create an index with the given keys and options. If the creation of the index is not doable because an index with the same keys but with different IndexOptions already exists, then drop the existing index and create a new one.
properties
- the properties, which must contain at least one
indexOptions
- the options for the index
Return
the index name