Method CreateOneAsync
| MongoDB CSharp Driver API Reference (original) (raw)
Namespace
Assembly
MongoDB.Driver.dll
CreateOneAsync(IndexKeysDefinition, CreateIndexOptions, CancellationToken)
Creates an index.
[Obsolete("Use CreateOneAsync with a CreateIndexModel instead.")]
public virtual Task<string> CreateOneAsync(IndexKeysDefinition<TDocument> keys, CreateIndexOptions options = null, CancellationToken cancellationToken = default)
Parameters
keys
IndexKeysDefinition
The keys.
options
CreateIndexOptions
The create index request options.
cancellationToken
CancellationToken
The cancellation token.
Returns
A task whose result is the name of the index that was created.
CreateOneAsync(CreateIndexModel, CreateOneIndexOptions, CancellationToken)
Creates an index.
public virtual Task<string> CreateOneAsync(CreateIndexModel<TDocument> model, CreateOneIndexOptions options = null, CancellationToken cancellationToken = default)
Parameters
model
CreateIndexModel
The model defining the index.
options
CreateOneIndexOptions
The create index operation options.
cancellationToken
CancellationToken
The cancellation token.
Returns
A task whose result is the name of the index that was created.
CreateOneAsync(IClientSessionHandle, IndexKeysDefinition, CreateIndexOptions, CancellationToken)
Creates an index.
[Obsolete("Use CreateOneAsync with a CreateIndexModel instead.")]
public virtual Task<string> CreateOneAsync(IClientSessionHandle session, IndexKeysDefinition<TDocument> keys, CreateIndexOptions options = null, CancellationToken cancellationToken = default)
Parameters
session
IClientSessionHandle
The session.
keys
IndexKeysDefinition
The keys.
options
CreateIndexOptions
The create index request options.
cancellationToken
CancellationToken
The cancellation token.
Returns
A task whose result is the name of the index that was created.
CreateOneAsync(IClientSessionHandle, CreateIndexModel, CreateOneIndexOptions, CancellationToken)
Creates an index.
public virtual Task<string> CreateOneAsync(IClientSessionHandle session, CreateIndexModel<TDocument> model, CreateOneIndexOptions options = null, CancellationToken cancellationToken = default)
Parameters
session
IClientSessionHandle
The session.
model
CreateIndexModel
The model defining the index.
options
CreateOneIndexOptions
The create index operation options.
cancellationToken
CancellationToken
The cancellation token.
Returns
A task whose result is the name of the index that was created.