Class MongoIndexManagerBase<TDocument>
Base class for implementors of IMongoIndexManager<TDocument>.
public abstract class MongoIndexManagerBase<TDocument> : IMongoIndexManager<TDocument>
Type Parameters
TDocument
The type of the document.
- Inheritance
-
MongoIndexManagerBase<TDocument>
- Implements
-
IMongoIndexManager<TDocument>
- Inherited Members
Properties
CollectionNamespace
Gets the namespace of the collection.
public abstract CollectionNamespace CollectionNamespace { get; }
Property Value
DocumentSerializer
Gets the document serializer.
public abstract IBsonSerializer<TDocument> DocumentSerializer { get; }
Property Value
- IBsonSerializer<TDocument>
Settings
Gets the collection settings.
public abstract MongoCollectionSettings Settings { get; }
Property Value
Methods
CreateMany(IClientSessionHandle, IEnumerable<CreateIndexModel<TDocument>>, CreateManyIndexesOptions, CancellationToken)
Creates multiple indexes.
public virtual 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.
public virtual 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.
public virtual 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.
public virtual 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.
public virtual 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.
public virtual 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.
public virtual 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.
public virtual 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.
public virtual 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.
public virtual 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.")]
public virtual 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.")]
public virtual 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.
public virtual 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.
public virtual 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 CreateOneAsync with a CreateIndexModel instead.")]
public virtual 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.")]
public virtual 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.
public virtual void DropAll(DropIndexOptions options, CancellationToken cancellationToken = default)
Parameters
options
DropIndexOptionsThe options.
cancellationToken
CancellationTokenThe cancellation token.
DropAll(IClientSessionHandle, DropIndexOptions, CancellationToken)
Drops all the indexes.
public virtual 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.
public virtual void DropAll(IClientSessionHandle session, CancellationToken cancellationToken = default)
Parameters
session
IClientSessionHandleThe session.
cancellationToken
CancellationTokenThe cancellation token.
DropAll(CancellationToken)
Drops all the indexes.
public virtual void DropAll(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationTokenThe cancellation token.
DropAllAsync(DropIndexOptions, CancellationToken)
Drops all the indexes.
public virtual Task DropAllAsync(DropIndexOptions options, CancellationToken cancellationToken)
Parameters
options
DropIndexOptionsThe options.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- Task
A task.
DropAllAsync(IClientSessionHandle, DropIndexOptions, CancellationToken)
Drops all the indexes.
public virtual Task DropAllAsync(IClientSessionHandle session, DropIndexOptions options, CancellationToken cancellationToken)
Parameters
session
IClientSessionHandleThe session.
options
DropIndexOptionsThe options.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- Task
A task.
DropAllAsync(IClientSessionHandle, CancellationToken)
Drops all the indexes.
public virtual 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.
public abstract 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.
public virtual void DropOne(IClientSessionHandle session, string name, DropIndexOptions options, CancellationToken cancellationToken)
Parameters
session
IClientSessionHandleThe session.
name
stringThe name.
options
DropIndexOptionsThe options.
cancellationToken
CancellationTokenThe cancellation token.
DropOne(IClientSessionHandle, string, CancellationToken)
Drops an index by its name.
public virtual 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.
public virtual 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.
public virtual 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.
public virtual Task DropOneAsync(IClientSessionHandle session, string name, DropIndexOptions options, CancellationToken cancellationToken)
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.
public virtual 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.
public virtual 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.
public abstract 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.
public virtual IAsyncCursor<BsonDocument> List(IClientSessionHandle session, ListIndexesOptions options, 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.
public virtual 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.
public virtual 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.
public virtual IAsyncCursor<BsonDocument> List(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationTokenThe cancellation token.
Returns
- IAsyncCursor<BsonDocument>
A cursor.
ListAsync(IClientSessionHandle, ListIndexesOptions, CancellationToken)
Lists the indexes.
public virtual Task<IAsyncCursor<BsonDocument>> ListAsync(IClientSessionHandle session, ListIndexesOptions options, 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.
public virtual 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.
public virtual 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.
public abstract Task<IAsyncCursor<BsonDocument>> ListAsync(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationTokenThe cancellation token.
Returns
- Task<IAsyncCursor<BsonDocument>>
A Task whose result is a cursor.