Method EnsureIndex
EnsureIndex(IMongoIndexKeys, IMongoIndexOptions)
Ensures that the desired index exists and creates it if it does not.
[Obsolete("Use CreateIndex instead.")]
public virtual void EnsureIndex(IMongoIndexKeys keys, IMongoIndexOptions options)
Parameters
keysIMongoIndexKeysThe indexed fields (usually an IndexKeysDocument or constructed using the IndexKeys builder).
optionsIMongoIndexOptionsThe index options(usually an IndexOptionsDocument or created using the IndexOption builder).
EnsureIndex(IMongoIndexKeys)
Ensures that the desired index exists and creates it if it does not.
[Obsolete("Use CreateIndex instead.")]
public virtual void EnsureIndex(IMongoIndexKeys keys)
Parameters
keysIMongoIndexKeysThe indexed fields (usually an IndexKeysDocument or constructed using the IndexKeys builder).
EnsureIndex(params string[])
Ensures that the desired index exists and creates it if it does not.
[Obsolete("Use CreateIndex instead.")]
public virtual void EnsureIndex(params string[] keyNames)
Parameters
keyNamesstring[]The names of the indexed fields.