Table of Contents

Method CreateIndex

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.Legacy.dll

CreateIndex(IMongoIndexKeys, IMongoIndexOptions)

Creates an index for this collection.

public virtual WriteConcernResult CreateIndex(IMongoIndexKeys keys, IMongoIndexOptions options)

Parameters

keys IMongoIndexKeys

The indexed fields (usually an IndexKeysDocument or constructed using the IndexKeys builder).

options IMongoIndexOptions

The 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

keys IMongoIndexKeys

The 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

keyNames string[]

The names of the indexed fields.

Returns

WriteConcernResult

A WriteConcernResult.