Method CreateIndex
CreateIndex(IMongoIndexKeys, IMongoIndexOptions)
Creates an index for this collection.
public virtual WriteConcernResult CreateIndex(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).
Returns
- WriteConcernResult
A WriteConcernResult.
CreateIndex(IMongoIndexKeys)
Creates an index for this collection.
public virtual WriteConcernResult CreateIndex(IMongoIndexKeys keys)
Parameters
keysIMongoIndexKeysThe indexed fields (usually an IndexKeysDocument or constructed using the IndexKeys builder).
Returns
- WriteConcernResult
A WriteConcernResult.
CreateIndex(params string[])
Creates an index for this collection.
public virtual WriteConcernResult CreateIndex(params string[] keyNames)
Parameters
keyNamesstring[]The names of the indexed fields.
Returns
- WriteConcernResult
A WriteConcernResult.