Interface IMongoIndexManager<TDocument>
An interface representing methods used to create, delete and modify indexes.
public interface IMongoIndexManager<TDocument>
Type Parameters
TDocument
The type of the document.
Remarks
This interface is not guaranteed to remain stable. Implementors should use MongoIndexManagerBase<TDocument>.
Properties
CollectionNamespace
Gets the namespace of the collection.
CollectionNamespace CollectionNamespace { get; }
Property Value
DocumentSerializer
Gets the document serializer.
IBsonSerializer<TDocument> DocumentSerializer { get; }
Property Value
- IBsonSerializer<TDocument>
Settings
Gets the collection settings.
MongoCollectionSettings Settings { get; }
Property Value
Methods
CreateMany(IClientSessionHandle, IEnumerable<CreateIndexModel<TDocument>>, CreateManyIndexesOptions, CancellationToken)
Creates multiple indexes.
IEnumerable<string> CreateMany(IClientSessionHandle session, IEnumerable<CreateIndexModel<TDocument>> models, CreateManyIndexesOptions options, CancellationToken cancellationToken = default)
Parameters
session
IClientSessionHandleThe session.
models
IEnumerable<CreateIndexModel<TDocument>>The models defining each of the indexes.
options
CreateManyIndexesOptionsThe options for create multiple indexes.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- IEnumerable<string>
An IEnumerable<T> of the names of the indexes that were created.
CreateMany(IClientSessionHandle, IEnumerable<CreateIndexModel<TDocument>>, CancellationToken)
Creates multiple indexes.
IEnumerable<string> CreateMany(IClientSessionHandle session, IEnumerable<CreateIndexModel<TDocument>> models, CancellationToken cancellationToken = default)
Parameters
session
IClientSessionHandleThe session.
models
IEnumerable<CreateIndexModel<TDocument>>The models defining each of the indexes.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- IEnumerable<string>
An IEnumerable<T> of the names of the indexes that were created.
CreateMany(IEnumerable<CreateIndexModel<TDocument>>, CreateManyIndexesOptions, CancellationToken)
Creates multiple indexes.
IEnumerable<string> CreateMany(IEnumerable<CreateIndexModel<TDocument>> models, CreateManyIndexesOptions options, CancellationToken cancellationToken = default)
Parameters
models
IEnumerable<CreateIndexModel<TDocument>>The models defining each of the indexes.
options
CreateManyIndexesOptionsThe options for create multiple indexes.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- IEnumerable<string>
An IEnumerable<T> of the names of the indexes that were created.
CreateMany(IEnumerable<CreateIndexModel<TDocument>>, CancellationToken)
Creates multiple indexes.
IEnumerable<string> CreateMany(IEnumerable<CreateIndexModel<TDocument>> models, CancellationToken cancellationToken = default)
Parameters
models
IEnumerable<CreateIndexModel<TDocument>>The models defining each of the indexes.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- IEnumerable<string>
An IEnumerable<T> of the names of the indexes that were created.
CreateManyAsync(IClientSessionHandle, IEnumerable<CreateIndexModel<TDocument>>, CreateManyIndexesOptions, CancellationToken)
Creates multiple indexes.
Task<IEnumerable<string>> CreateManyAsync(IClientSessionHandle session, IEnumerable<CreateIndexModel<TDocument>> models, CreateManyIndexesOptions options, CancellationToken cancellationToken = default)
Parameters
session
IClientSessionHandleThe session.
models
IEnumerable<CreateIndexModel<TDocument>>The models defining each of the indexes.
options
CreateManyIndexesOptionsThe options for create multiple indexes.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- Task<IEnumerable<string>>
A task whose result is an IEnumerable<T> of the names of the indexes that were created.
CreateManyAsync(IClientSessionHandle, IEnumerable<CreateIndexModel<TDocument>>, CancellationToken)
Creates multiple indexes.
Task<IEnumerable<string>> CreateManyAsync(IClientSessionHandle session, IEnumerable<CreateIndexModel<TDocument>> models, CancellationToken cancellationToken = default)
Parameters
session
IClientSessionHandleThe session.
models
IEnumerable<CreateIndexModel<TDocument>>The models defining each of the indexes.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- Task<IEnumerable<string>>
A task whose result is an IEnumerable<T> of the names of the indexes that were created.
CreateManyAsync(IEnumerable<CreateIndexModel<TDocument>>, CreateManyIndexesOptions, CancellationToken)
Creates multiple indexes.
Task<IEnumerable<string>> CreateManyAsync(IEnumerable<CreateIndexModel<TDocument>> models, CreateManyIndexesOptions options, CancellationToken cancellationToken = default)
Parameters
models
IEnumerable<CreateIndexModel<TDocument>>The models defining each of the indexes.
options
CreateManyIndexesOptionsThe options for create multiple indexes.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- Task<IEnumerable<string>>
A task whose result is an IEnumerable<T> of the names of the indexes that were created.
CreateManyAsync(IEnumerable<CreateIndexModel<TDocument>>, CancellationToken)
Creates multiple indexes.
Task<IEnumerable<string>> CreateManyAsync(IEnumerable<CreateIndexModel<TDocument>> models, CancellationToken cancellationToken = default)
Parameters
models
IEnumerable<CreateIndexModel<TDocument>>The models defining each of the indexes.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- Task<IEnumerable<string>>
A task whose result is an IEnumerable<T> of the names of the indexes that were created.
CreateOne(CreateIndexModel<TDocument>, CreateOneIndexOptions, CancellationToken)
Creates an index.
string CreateOne(CreateIndexModel<TDocument> model, CreateOneIndexOptions options = null, CancellationToken cancellationToken = default)
Parameters
model
CreateIndexModel<TDocument>The model defining the index.
options
CreateOneIndexOptionsThe create index operation options.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- string
The name of the index that was created.
CreateOne(IClientSessionHandle, CreateIndexModel<TDocument>, CreateOneIndexOptions, CancellationToken)
Creates an index.
string CreateOne(IClientSessionHandle session, CreateIndexModel<TDocument> model, CreateOneIndexOptions options = null, CancellationToken cancellationToken = default)
Parameters
session
IClientSessionHandleThe session.
model
CreateIndexModel<TDocument>The model defining the index.
options
CreateOneIndexOptionsThe create index operation options.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- string
The name of the index that was created.
CreateOne(IClientSessionHandle, IndexKeysDefinition<TDocument>, CreateIndexOptions, CancellationToken)
Creates an index.
[Obsolete("Use CreateOne with a CreateIndexModel instead.")]
string CreateOne(IClientSessionHandle session, IndexKeysDefinition<TDocument> keys, CreateIndexOptions options = null, CancellationToken cancellationToken = default)
Parameters
session
IClientSessionHandleThe session.
keys
IndexKeysDefinition<TDocument>The keys.
options
CreateIndexOptionsThe create index request options.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- string
The name of the index that was created.
CreateOne(IndexKeysDefinition<TDocument>, CreateIndexOptions, CancellationToken)
Creates an index.
[Obsolete("Use CreateOne with a CreateIndexModel instead.")]
string CreateOne(IndexKeysDefinition<TDocument> keys, CreateIndexOptions options = null, CancellationToken cancellationToken = default)
Parameters
keys
IndexKeysDefinition<TDocument>The keys.
options
CreateIndexOptionsThe create index request options.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- string
The name of the index that was created.
CreateOneAsync(CreateIndexModel<TDocument>, CreateOneIndexOptions, CancellationToken)
Creates an index.
Task<string> CreateOneAsync(CreateIndexModel<TDocument> model, CreateOneIndexOptions options = null, CancellationToken cancellationToken = default)
Parameters
model
CreateIndexModel<TDocument>The model defining the index.
options
CreateOneIndexOptionsThe create index operation options.
cancellationToken
CancellationTokenThe cancellation token.
Returns
CreateOneAsync(IClientSessionHandle, CreateIndexModel<TDocument>, CreateOneIndexOptions, CancellationToken)
Creates an index.
Task<string> CreateOneAsync(IClientSessionHandle session, CreateIndexModel<TDocument> model, CreateOneIndexOptions options = null, CancellationToken cancellationToken = default)
Parameters
session
IClientSessionHandleThe session.
model
CreateIndexModel<TDocument>The model defining the index.
options
CreateOneIndexOptionsThe create index operation options.
cancellationToken
CancellationTokenThe cancellation token.
Returns
CreateOneAsync(IClientSessionHandle, IndexKeysDefinition<TDocument>, CreateIndexOptions, CancellationToken)
Creates an index.
[Obsolete("Use CreateOneAsyc with a CreateIndexModel instead.")]
Task<string> CreateOneAsync(IClientSessionHandle session, IndexKeysDefinition<TDocument> keys, CreateIndexOptions options = null, CancellationToken cancellationToken = default)
Parameters
session
IClientSessionHandleThe session.
keys
IndexKeysDefinition<TDocument>The keys.
options
CreateIndexOptionsThe create index request options.
cancellationToken
CancellationTokenThe cancellation token.
Returns
CreateOneAsync(IndexKeysDefinition<TDocument>, CreateIndexOptions, CancellationToken)
Creates an index.
[Obsolete("Use CreateOneAsync with a CreateIndexModel instead.")]
Task<string> CreateOneAsync(IndexKeysDefinition<TDocument> keys, CreateIndexOptions options = null, CancellationToken cancellationToken = default)
Parameters
keys
IndexKeysDefinition<TDocument>The keys.
options
CreateIndexOptionsThe create index request options.
cancellationToken
CancellationTokenThe cancellation token.
Returns
DropAll(DropIndexOptions, CancellationToken)
Drops all the indexes.
void DropAll(DropIndexOptions options, CancellationToken cancellationToken = default)
Parameters
options
DropIndexOptionsThe options.
cancellationToken
CancellationTokenThe cancellation token.
DropAll(IClientSessionHandle, DropIndexOptions, CancellationToken)
Drops all the indexes.
void DropAll(IClientSessionHandle session, DropIndexOptions options, CancellationToken cancellationToken = default)
Parameters
session
IClientSessionHandleThe session.
options
DropIndexOptionsThe options.
cancellationToken
CancellationTokenThe cancellation token.
DropAll(IClientSessionHandle, CancellationToken)
Drops all the indexes.
void DropAll(IClientSessionHandle session, CancellationToken cancellationToken = default)
Parameters
session
IClientSessionHandleThe session.
cancellationToken
CancellationTokenThe cancellation token.
DropAll(CancellationToken)
Drops all the indexes.
void DropAll(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationTokenThe cancellation token.
DropAllAsync(DropIndexOptions, CancellationToken)
Drops all the indexes.
Task DropAllAsync(DropIndexOptions options, CancellationToken cancellationToken = default)
Parameters
options
DropIndexOptionsThe options.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- Task
A task.
DropAllAsync(IClientSessionHandle, DropIndexOptions, CancellationToken)
Drops all the indexes.
Task DropAllAsync(IClientSessionHandle session, DropIndexOptions options, CancellationToken cancellationToken = default)
Parameters
session
IClientSessionHandleThe session.
options
DropIndexOptionsThe options.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- Task
A task.
DropAllAsync(IClientSessionHandle, CancellationToken)
Drops all the indexes.
Task DropAllAsync(IClientSessionHandle session, CancellationToken cancellationToken = default)
Parameters
session
IClientSessionHandleThe session.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- Task
A task.
DropAllAsync(CancellationToken)
Drops all the indexes.
Task DropAllAsync(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationTokenThe cancellation token.
Returns
- Task
A task.
DropOne(IClientSessionHandle, string, DropIndexOptions, CancellationToken)
Drops an index by its name.
void DropOne(IClientSessionHandle session, string name, DropIndexOptions options, CancellationToken cancellationToken = default)
Parameters
session
IClientSessionHandleThe session.
name
stringThe name.
options
DropIndexOptionsThe options.
cancellationToken
CancellationTokenThe cancellation token.
DropOne(IClientSessionHandle, string, CancellationToken)
Drops an index by its name.
void DropOne(IClientSessionHandle session, string name, CancellationToken cancellationToken = default)
Parameters
session
IClientSessionHandleThe session.
name
stringThe name.
cancellationToken
CancellationTokenThe cancellation token.
DropOne(string, DropIndexOptions, CancellationToken)
Drops an index by its name.
void DropOne(string name, DropIndexOptions options, CancellationToken cancellationToken = default)
Parameters
name
stringThe name.
options
DropIndexOptionsThe options.
cancellationToken
CancellationTokenThe cancellation token.
DropOne(string, CancellationToken)
Drops an index by its name.
void DropOne(string name, CancellationToken cancellationToken = default)
Parameters
name
stringThe name.
cancellationToken
CancellationTokenThe cancellation token.
DropOneAsync(IClientSessionHandle, string, DropIndexOptions, CancellationToken)
Drops an index by its name.
Task DropOneAsync(IClientSessionHandle session, string name, DropIndexOptions options, CancellationToken cancellationToken = default)
Parameters
session
IClientSessionHandleThe session.
name
stringThe name.
options
DropIndexOptionsThe options.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- Task
A task.
DropOneAsync(IClientSessionHandle, string, CancellationToken)
Drops an index by its name.
Task DropOneAsync(IClientSessionHandle session, string name, CancellationToken cancellationToken = default)
Parameters
session
IClientSessionHandleThe session.
name
stringThe name.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- Task
A task.
DropOneAsync(string, DropIndexOptions, CancellationToken)
Drops an index by its name.
Task DropOneAsync(string name, DropIndexOptions options, CancellationToken cancellationToken = default)
Parameters
name
stringThe name.
options
DropIndexOptionsThe options.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- Task
A task.
DropOneAsync(string, CancellationToken)
Drops an index by its name.
Task DropOneAsync(string name, CancellationToken cancellationToken = default)
Parameters
name
stringThe name.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- Task
A task.
List(IClientSessionHandle, ListIndexesOptions, CancellationToken)
Lists the indexes.
IAsyncCursor<BsonDocument> List(IClientSessionHandle session, ListIndexesOptions options = null, CancellationToken cancellationToken = default)
Parameters
session
IClientSessionHandleThe session.
options
ListIndexesOptionsThe options.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- IAsyncCursor<BsonDocument>
A cursor.
List(IClientSessionHandle, CancellationToken)
Lists the indexes.
IAsyncCursor<BsonDocument> List(IClientSessionHandle session, CancellationToken cancellationToken = default)
Parameters
session
IClientSessionHandleThe session.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- IAsyncCursor<BsonDocument>
A cursor.
List(ListIndexesOptions, CancellationToken)
Lists the indexes.
IAsyncCursor<BsonDocument> List(ListIndexesOptions options, CancellationToken cancellationToken = default)
Parameters
options
ListIndexesOptionsThe options.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- IAsyncCursor<BsonDocument>
A cursor.
List(CancellationToken)
Lists the indexes.
IAsyncCursor<BsonDocument> List(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationTokenThe cancellation token.
Returns
- IAsyncCursor<BsonDocument>
A cursor.
ListAsync(IClientSessionHandle, ListIndexesOptions, CancellationToken)
Lists the indexes.
Task<IAsyncCursor<BsonDocument>> ListAsync(IClientSessionHandle session, ListIndexesOptions options = null, CancellationToken cancellationToken = default)
Parameters
session
IClientSessionHandleThe session.
options
ListIndexesOptionsThe options.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- Task<IAsyncCursor<BsonDocument>>
A Task whose result is a cursor.
ListAsync(IClientSessionHandle, CancellationToken)
Lists the indexes.
Task<IAsyncCursor<BsonDocument>> ListAsync(IClientSessionHandle session, CancellationToken cancellationToken = default)
Parameters
session
IClientSessionHandleThe session.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- Task<IAsyncCursor<BsonDocument>>
A Task whose result is a cursor.
ListAsync(ListIndexesOptions, CancellationToken)
Lists the indexes.
Task<IAsyncCursor<BsonDocument>> ListAsync(ListIndexesOptions options, CancellationToken cancellationToken = default)
Parameters
options
ListIndexesOptionsThe options.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- Task<IAsyncCursor<BsonDocument>>
A Task whose result is a cursor.
ListAsync(CancellationToken)
Lists the indexes.
Task<IAsyncCursor<BsonDocument>> ListAsync(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationTokenThe cancellation token.
Returns
- Task<IAsyncCursor<BsonDocument>>
A Task whose result is a cursor.