MongoRepository documentation
MongoRepositoryManagerT, TKeyEnsureIndex Method (String, Boolean, Boolean, Boolean) |
Ensures that the desired index exist and creates it if it doesn't exist.
Namespace: MongoRepository
Assembly: MongoRepository.Net45 (in MongoRepository.Net45.dll) Version: 1.6.11.0 (1.6.11.0)
Syntax
public virtual void EnsureIndex( string keyname, bool descending, bool unique, bool sparse )
Public Overridable Sub EnsureIndex ( keyname As String, descending As Boolean, unique As Boolean, sparse As Boolean )
public: virtual void EnsureIndex( String^ keyname, bool descending, bool unique, bool sparse )
abstract EnsureIndex : keyname : string * descending : bool * unique : bool * sparse : bool -> unit override EnsureIndex : keyname : string * descending : bool * unique : bool * sparse : bool -> unit
Parameters
- keyname
- Type: SystemString
The indexed field. - descending
- Type: SystemBoolean
Set to true to make index descending, false for ascending. - unique
- Type: SystemBoolean
Set to true to ensure index enforces unique values. - sparse
- Type: SystemBoolean
Set to true to specify the index is sparse.
Implements
IRepositoryManagerT, TKeyEnsureIndex(String, Boolean, Boolean, Boolean)Remarks
This is a convenience method for EnsureIndexes(IMongoIndexKeys keys, IMongoIndexOptions options).
See Also