Table of Contents

Class IMongoCollectionExtensions

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.dll

Extension methods for IMongoCollection<TDocument>.

public static class IMongoCollectionExtensions
Inheritance
IMongoCollectionExtensions
Inherited Members

Methods

Aggregate<TDocument>(IMongoCollection<TDocument>, AggregateOptions)

Begins a fluent aggregation interface.

Aggregate<TDocument>(IMongoCollection<TDocument>, IClientSessionHandle, AggregateOptions)

Begins a fluent aggregation interface.

AsQueryable<TDocument>(IMongoCollection<TDocument>, AggregateOptions)

Creates a queryable source of documents.

AsQueryable<TDocument>(IMongoCollection<TDocument>, IClientSessionHandle, AggregateOptions)

Creates a queryable source of documents.

CountAsync<TDocument>(IMongoCollection<TDocument>, IClientSessionHandle, Expression<Func<TDocument, bool>>, CountOptions, CancellationToken)

Counts the number of documents in the collection.

CountAsync<TDocument>(IMongoCollection<TDocument>, Expression<Func<TDocument, bool>>, CountOptions, CancellationToken)

Counts the number of documents in the collection.

CountDocumentsAsync<TDocument>(IMongoCollection<TDocument>, IClientSessionHandle, Expression<Func<TDocument, bool>>, CountOptions, CancellationToken)

Counts the number of documents in the collection. For a fast estimate of the total documents in a collection see EstimatedDocumentCountAsync(EstimatedDocumentCountOptions, CancellationToken).

CountDocumentsAsync<TDocument>(IMongoCollection<TDocument>, Expression<Func<TDocument, bool>>, CountOptions, CancellationToken)

Counts the number of documents in the collection. For a fast estimate of the total documents in a collection see EstimatedDocumentCountAsync(EstimatedDocumentCountOptions, CancellationToken).

CountDocuments<TDocument>(IMongoCollection<TDocument>, IClientSessionHandle, Expression<Func<TDocument, bool>>, CountOptions, CancellationToken)

Counts the number of documents in the collection. For a fast estimate of the total documents in a collection see EstimatedDocumentCount(EstimatedDocumentCountOptions, CancellationToken).

CountDocuments<TDocument>(IMongoCollection<TDocument>, Expression<Func<TDocument, bool>>, CountOptions, CancellationToken)

Counts the number of documents in the collection. For a fast estimate of the total documents in a collection see EstimatedDocumentCount(EstimatedDocumentCountOptions, CancellationToken).

Count<TDocument>(IMongoCollection<TDocument>, IClientSessionHandle, Expression<Func<TDocument, bool>>, CountOptions, CancellationToken)

Counts the number of documents in the collection.

Count<TDocument>(IMongoCollection<TDocument>, Expression<Func<TDocument, bool>>, CountOptions, CancellationToken)

Counts the number of documents in the collection.

DeleteManyAsync<TDocument>(IMongoCollection<TDocument>, IClientSessionHandle, Expression<Func<TDocument, bool>>, DeleteOptions, CancellationToken)

Deletes multiple documents.

DeleteManyAsync<TDocument>(IMongoCollection<TDocument>, Expression<Func<TDocument, bool>>, DeleteOptions, CancellationToken)

Deletes multiple documents.

DeleteManyAsync<TDocument>(IMongoCollection<TDocument>, Expression<Func<TDocument, bool>>, CancellationToken)

Deletes multiple documents.

DeleteMany<TDocument>(IMongoCollection<TDocument>, IClientSessionHandle, Expression<Func<TDocument, bool>>, DeleteOptions, CancellationToken)

Deletes multiple documents.

DeleteMany<TDocument>(IMongoCollection<TDocument>, Expression<Func<TDocument, bool>>, DeleteOptions, CancellationToken)

Deletes multiple documents.

DeleteMany<TDocument>(IMongoCollection<TDocument>, Expression<Func<TDocument, bool>>, CancellationToken)

Deletes multiple documents.

DeleteOneAsync<TDocument>(IMongoCollection<TDocument>, IClientSessionHandle, Expression<Func<TDocument, bool>>, DeleteOptions, CancellationToken)

Deletes a single document.

DeleteOneAsync<TDocument>(IMongoCollection<TDocument>, Expression<Func<TDocument, bool>>, DeleteOptions, CancellationToken)

Deletes a single document.

DeleteOneAsync<TDocument>(IMongoCollection<TDocument>, Expression<Func<TDocument, bool>>, CancellationToken)

Deletes a single document.

DeleteOne<TDocument>(IMongoCollection<TDocument>, IClientSessionHandle, Expression<Func<TDocument, bool>>, DeleteOptions, CancellationToken)

Deletes a single document.

DeleteOne<TDocument>(IMongoCollection<TDocument>, Expression<Func<TDocument, bool>>, DeleteOptions, CancellationToken)

Deletes a single document.

DeleteOne<TDocument>(IMongoCollection<TDocument>, Expression<Func<TDocument, bool>>, CancellationToken)

Deletes a single document.

DistinctAsync<TDocument, TField>(IMongoCollection<TDocument>, FieldDefinition<TDocument, TField>, Expression<Func<TDocument, bool>>, DistinctOptions, CancellationToken)

Gets the distinct values for a specified field.

DistinctAsync<TDocument, TField>(IMongoCollection<TDocument>, IClientSessionHandle, FieldDefinition<TDocument, TField>, Expression<Func<TDocument, bool>>, DistinctOptions, CancellationToken)

Gets the distinct values for a specified field.

DistinctAsync<TDocument, TField>(IMongoCollection<TDocument>, IClientSessionHandle, Expression<Func<TDocument, TField>>, FilterDefinition<TDocument>, DistinctOptions, CancellationToken)

Gets the distinct values for a specified field.

DistinctAsync<TDocument, TField>(IMongoCollection<TDocument>, IClientSessionHandle, Expression<Func<TDocument, TField>>, Expression<Func<TDocument, bool>>, DistinctOptions, CancellationToken)

Gets the distinct values for a specified field.

DistinctAsync<TDocument, TField>(IMongoCollection<TDocument>, Expression<Func<TDocument, TField>>, FilterDefinition<TDocument>, DistinctOptions, CancellationToken)

Gets the distinct values for a specified field.

DistinctAsync<TDocument, TField>(IMongoCollection<TDocument>, Expression<Func<TDocument, TField>>, Expression<Func<TDocument, bool>>, DistinctOptions, CancellationToken)

Gets the distinct values for a specified field.

Distinct<TDocument, TField>(IMongoCollection<TDocument>, FieldDefinition<TDocument, TField>, Expression<Func<TDocument, bool>>, DistinctOptions, CancellationToken)

Gets the distinct values for a specified field.

Distinct<TDocument, TField>(IMongoCollection<TDocument>, IClientSessionHandle, FieldDefinition<TDocument, TField>, Expression<Func<TDocument, bool>>, DistinctOptions, CancellationToken)

Gets the distinct values for a specified field.

Distinct<TDocument, TField>(IMongoCollection<TDocument>, IClientSessionHandle, Expression<Func<TDocument, TField>>, FilterDefinition<TDocument>, DistinctOptions, CancellationToken)

Gets the distinct values for a specified field.

Distinct<TDocument, TField>(IMongoCollection<TDocument>, IClientSessionHandle, Expression<Func<TDocument, TField>>, Expression<Func<TDocument, bool>>, DistinctOptions, CancellationToken)

Gets the distinct values for a specified field.

Distinct<TDocument, TField>(IMongoCollection<TDocument>, Expression<Func<TDocument, TField>>, FilterDefinition<TDocument>, DistinctOptions, CancellationToken)

Gets the distinct values for a specified field.

Distinct<TDocument, TField>(IMongoCollection<TDocument>, Expression<Func<TDocument, TField>>, Expression<Func<TDocument, bool>>, DistinctOptions, CancellationToken)

Gets the distinct values for a specified field.

FindAsync<TDocument>(IMongoCollection<TDocument>, FilterDefinition<TDocument>, FindOptions<TDocument, TDocument>, CancellationToken)

Finds the documents matching the filter.

FindAsync<TDocument>(IMongoCollection<TDocument>, IClientSessionHandle, FilterDefinition<TDocument>, FindOptions<TDocument, TDocument>, CancellationToken)

Finds the documents matching the filter.

FindAsync<TDocument>(IMongoCollection<TDocument>, IClientSessionHandle, Expression<Func<TDocument, bool>>, FindOptions<TDocument, TDocument>, CancellationToken)

Finds the documents matching the filter.

FindAsync<TDocument>(IMongoCollection<TDocument>, Expression<Func<TDocument, bool>>, FindOptions<TDocument, TDocument>, CancellationToken)

Finds the documents matching the filter.

FindOneAndDeleteAsync<TDocument>(IMongoCollection<TDocument>, FilterDefinition<TDocument>, FindOneAndDeleteOptions<TDocument, TDocument>, CancellationToken)

Finds a single document and deletes it atomically.

FindOneAndDeleteAsync<TDocument>(IMongoCollection<TDocument>, IClientSessionHandle, FilterDefinition<TDocument>, FindOneAndDeleteOptions<TDocument, TDocument>, CancellationToken)

Finds a single document and deletes it atomically.

FindOneAndDeleteAsync<TDocument>(IMongoCollection<TDocument>, IClientSessionHandle, Expression<Func<TDocument, bool>>, FindOneAndDeleteOptions<TDocument, TDocument>, CancellationToken)

Finds a single document and deletes it atomically.

FindOneAndDeleteAsync<TDocument>(IMongoCollection<TDocument>, Expression<Func<TDocument, bool>>, FindOneAndDeleteOptions<TDocument, TDocument>, CancellationToken)

Finds a single document and deletes it atomically.

FindOneAndDeleteAsync<TDocument, TProjection>(IMongoCollection<TDocument>, IClientSessionHandle, Expression<Func<TDocument, bool>>, FindOneAndDeleteOptions<TDocument, TProjection>, CancellationToken)

Finds a single document and deletes it atomically.

FindOneAndDeleteAsync<TDocument, TProjection>(IMongoCollection<TDocument>, Expression<Func<TDocument, bool>>, FindOneAndDeleteOptions<TDocument, TProjection>, CancellationToken)

Finds a single document and deletes it atomically.

FindOneAndDelete<TDocument>(IMongoCollection<TDocument>, FilterDefinition<TDocument>, FindOneAndDeleteOptions<TDocument, TDocument>, CancellationToken)

Finds a single document and deletes it atomically.

FindOneAndDelete<TDocument>(IMongoCollection<TDocument>, IClientSessionHandle, FilterDefinition<TDocument>, FindOneAndDeleteOptions<TDocument, TDocument>, CancellationToken)

Finds a single document and deletes it atomically.

FindOneAndDelete<TDocument>(IMongoCollection<TDocument>, IClientSessionHandle, Expression<Func<TDocument, bool>>, FindOneAndDeleteOptions<TDocument, TDocument>, CancellationToken)

Finds a single document and deletes it atomically.

FindOneAndDelete<TDocument>(IMongoCollection<TDocument>, Expression<Func<TDocument, bool>>, FindOneAndDeleteOptions<TDocument, TDocument>, CancellationToken)

Finds a single document and deletes it atomically.

FindOneAndDelete<TDocument, TProjection>(IMongoCollection<TDocument>, IClientSessionHandle, Expression<Func<TDocument, bool>>, FindOneAndDeleteOptions<TDocument, TProjection>, CancellationToken)

Finds a single document and deletes it atomically.

FindOneAndDelete<TDocument, TProjection>(IMongoCollection<TDocument>, Expression<Func<TDocument, bool>>, FindOneAndDeleteOptions<TDocument, TProjection>, CancellationToken)

Finds a single document and deletes it atomically.

FindOneAndReplaceAsync<TDocument>(IMongoCollection<TDocument>, FilterDefinition<TDocument>, TDocument, FindOneAndReplaceOptions<TDocument, TDocument>, CancellationToken)

Finds a single document and replaces it atomically.

FindOneAndReplaceAsync<TDocument>(IMongoCollection<TDocument>, IClientSessionHandle, FilterDefinition<TDocument>, TDocument, FindOneAndReplaceOptions<TDocument, TDocument>, CancellationToken)

Finds a single document and replaces it atomically.

FindOneAndReplaceAsync<TDocument>(IMongoCollection<TDocument>, Expression<Func<TDocument, bool>>, IClientSessionHandle, TDocument, FindOneAndReplaceOptions<TDocument, TDocument>, CancellationToken)

Finds a single document and replaces it atomically.

FindOneAndReplaceAsync<TDocument>(IMongoCollection<TDocument>, Expression<Func<TDocument, bool>>, TDocument, FindOneAndReplaceOptions<TDocument, TDocument>, CancellationToken)

Finds a single document and replaces it atomically.

FindOneAndReplaceAsync<TDocument, TProjection>(IMongoCollection<TDocument>, IClientSessionHandle, Expression<Func<TDocument, bool>>, TDocument, FindOneAndReplaceOptions<TDocument, TProjection>, CancellationToken)

Finds a single document and replaces it atomically.

FindOneAndReplaceAsync<TDocument, TProjection>(IMongoCollection<TDocument>, Expression<Func<TDocument, bool>>, TDocument, FindOneAndReplaceOptions<TDocument, TProjection>, CancellationToken)

Finds a single document and replaces it atomically.

FindOneAndReplace<TDocument>(IMongoCollection<TDocument>, FilterDefinition<TDocument>, TDocument, FindOneAndReplaceOptions<TDocument, TDocument>, CancellationToken)

Finds a single document and replaces it atomically.

FindOneAndReplace<TDocument>(IMongoCollection<TDocument>, IClientSessionHandle, FilterDefinition<TDocument>, TDocument, FindOneAndReplaceOptions<TDocument, TDocument>, CancellationToken)

Finds a single document and replaces it atomically.

FindOneAndReplace<TDocument>(IMongoCollection<TDocument>, IClientSessionHandle, Expression<Func<TDocument, bool>>, TDocument, FindOneAndReplaceOptions<TDocument, TDocument>, CancellationToken)

Finds a single document and replaces it atomically.

FindOneAndReplace<TDocument>(IMongoCollection<TDocument>, Expression<Func<TDocument, bool>>, TDocument, FindOneAndReplaceOptions<TDocument, TDocument>, CancellationToken)

Finds a single document and replaces it atomically.

FindOneAndReplace<TDocument, TProjection>(IMongoCollection<TDocument>, IClientSessionHandle, Expression<Func<TDocument, bool>>, TDocument, FindOneAndReplaceOptions<TDocument, TProjection>, CancellationToken)

Finds a single document and replaces it atomically.

FindOneAndReplace<TDocument, TProjection>(IMongoCollection<TDocument>, Expression<Func<TDocument, bool>>, TDocument, FindOneAndReplaceOptions<TDocument, TProjection>, CancellationToken)

Finds a single document and replaces it atomically.

FindOneAndUpdateAsync<TDocument>(IMongoCollection<TDocument>, FilterDefinition<TDocument>, UpdateDefinition<TDocument>, FindOneAndUpdateOptions<TDocument, TDocument>, CancellationToken)

Finds a single document and updates it atomically.

FindOneAndUpdateAsync<TDocument>(IMongoCollection<TDocument>, IClientSessionHandle, FilterDefinition<TDocument>, UpdateDefinition<TDocument>, FindOneAndUpdateOptions<TDocument, TDocument>, CancellationToken)

Finds a single document and updates it atomically.

FindOneAndUpdateAsync<TDocument>(IMongoCollection<TDocument>, IClientSessionHandle, Expression<Func<TDocument, bool>>, UpdateDefinition<TDocument>, FindOneAndUpdateOptions<TDocument, TDocument>, CancellationToken)

Finds a single document and updates it atomically.

FindOneAndUpdateAsync<TDocument>(IMongoCollection<TDocument>, Expression<Func<TDocument, bool>>, UpdateDefinition<TDocument>, FindOneAndUpdateOptions<TDocument, TDocument>, CancellationToken)

Finds a single document and updates it atomically.

FindOneAndUpdateAsync<TDocument, TProjection>(IMongoCollection<TDocument>, IClientSessionHandle, Expression<Func<TDocument, bool>>, UpdateDefinition<TDocument>, FindOneAndUpdateOptions<TDocument, TProjection>, CancellationToken)

Finds a single document and updates it atomically.

FindOneAndUpdateAsync<TDocument, TProjection>(IMongoCollection<TDocument>, Expression<Func<TDocument, bool>>, UpdateDefinition<TDocument>, FindOneAndUpdateOptions<TDocument, TProjection>, CancellationToken)

Finds a single document and updates it atomically.

FindOneAndUpdate<TDocument>(IMongoCollection<TDocument>, FilterDefinition<TDocument>, UpdateDefinition<TDocument>, FindOneAndUpdateOptions<TDocument, TDocument>, CancellationToken)

Finds a single document and updates it atomically.

FindOneAndUpdate<TDocument>(IMongoCollection<TDocument>, IClientSessionHandle, FilterDefinition<TDocument>, UpdateDefinition<TDocument>, FindOneAndUpdateOptions<TDocument, TDocument>, CancellationToken)

Finds a single document and updates it atomically.

FindOneAndUpdate<TDocument>(IMongoCollection<TDocument>, IClientSessionHandle, Expression<Func<TDocument, bool>>, UpdateDefinition<TDocument>, FindOneAndUpdateOptions<TDocument, TDocument>, CancellationToken)

Finds a single document and updates it atomically.

FindOneAndUpdate<TDocument>(IMongoCollection<TDocument>, Expression<Func<TDocument, bool>>, UpdateDefinition<TDocument>, FindOneAndUpdateOptions<TDocument, TDocument>, CancellationToken)

Finds a single document and updates it atomically.

FindOneAndUpdate<TDocument, TProjection>(IMongoCollection<TDocument>, IClientSessionHandle, Expression<Func<TDocument, bool>>, UpdateDefinition<TDocument>, FindOneAndUpdateOptions<TDocument, TProjection>, CancellationToken)

Finds a single document and updates it atomically.

FindOneAndUpdate<TDocument, TProjection>(IMongoCollection<TDocument>, Expression<Func<TDocument, bool>>, UpdateDefinition<TDocument>, FindOneAndUpdateOptions<TDocument, TProjection>, CancellationToken)

Finds a single document and updates it atomically.

FindSync<TDocument>(IMongoCollection<TDocument>, FilterDefinition<TDocument>, FindOptions<TDocument, TDocument>, CancellationToken)

Finds the documents matching the filter.

FindSync<TDocument>(IMongoCollection<TDocument>, IClientSessionHandle, FilterDefinition<TDocument>, FindOptions<TDocument, TDocument>, CancellationToken)

Finds the documents matching the filter.

FindSync<TDocument>(IMongoCollection<TDocument>, IClientSessionHandle, Expression<Func<TDocument, bool>>, FindOptions<TDocument, TDocument>, CancellationToken)

Finds the documents matching the filter.

FindSync<TDocument>(IMongoCollection<TDocument>, Expression<Func<TDocument, bool>>, FindOptions<TDocument, TDocument>, CancellationToken)

Finds the documents matching the filter.

Find<TDocument>(IMongoCollection<TDocument>, FilterDefinition<TDocument>, FindOptions)

Begins a fluent find interface.

Find<TDocument>(IMongoCollection<TDocument>, IClientSessionHandle, FilterDefinition<TDocument>, FindOptions)

Begins a fluent find interface.

Find<TDocument>(IMongoCollection<TDocument>, IClientSessionHandle, Expression<Func<TDocument, bool>>, FindOptions)

Begins a fluent find interface.

Find<TDocument>(IMongoCollection<TDocument>, Expression<Func<TDocument, bool>>, FindOptions)

Begins a fluent find interface.

ReplaceOneAsync<TDocument>(IMongoCollection<TDocument>, IClientSessionHandle, Expression<Func<TDocument, bool>>, TDocument, ReplaceOptions, CancellationToken)

Replaces a single document.

ReplaceOneAsync<TDocument>(IMongoCollection<TDocument>, IClientSessionHandle, Expression<Func<TDocument, bool>>, TDocument, UpdateOptions, CancellationToken)

Replaces a single document.

ReplaceOneAsync<TDocument>(IMongoCollection<TDocument>, Expression<Func<TDocument, bool>>, TDocument, ReplaceOptions, CancellationToken)

Replaces a single document.

ReplaceOneAsync<TDocument>(IMongoCollection<TDocument>, Expression<Func<TDocument, bool>>, TDocument, UpdateOptions, CancellationToken)

Replaces a single document.

ReplaceOne<TDocument>(IMongoCollection<TDocument>, IClientSessionHandle, Expression<Func<TDocument, bool>>, TDocument, ReplaceOptions, CancellationToken)

Replaces a single document.

ReplaceOne<TDocument>(IMongoCollection<TDocument>, IClientSessionHandle, Expression<Func<TDocument, bool>>, TDocument, UpdateOptions, CancellationToken)

Replaces a single document.

ReplaceOne<TDocument>(IMongoCollection<TDocument>, Expression<Func<TDocument, bool>>, TDocument, ReplaceOptions, CancellationToken)

Replaces a single document.

ReplaceOne<TDocument>(IMongoCollection<TDocument>, Expression<Func<TDocument, bool>>, TDocument, UpdateOptions, CancellationToken)

Replaces a single document.

UpdateManyAsync<TDocument>(IMongoCollection<TDocument>, IClientSessionHandle, Expression<Func<TDocument, bool>>, UpdateDefinition<TDocument>, UpdateOptions, CancellationToken)

Updates many documents.

UpdateManyAsync<TDocument>(IMongoCollection<TDocument>, Expression<Func<TDocument, bool>>, UpdateDefinition<TDocument>, UpdateOptions, CancellationToken)

Updates many documents.

UpdateMany<TDocument>(IMongoCollection<TDocument>, IClientSessionHandle, Expression<Func<TDocument, bool>>, UpdateDefinition<TDocument>, UpdateOptions, CancellationToken)

Updates many documents.

UpdateMany<TDocument>(IMongoCollection<TDocument>, Expression<Func<TDocument, bool>>, UpdateDefinition<TDocument>, UpdateOptions, CancellationToken)

Updates many documents.

UpdateOneAsync<TDocument>(IMongoCollection<TDocument>, IClientSessionHandle, Expression<Func<TDocument, bool>>, UpdateDefinition<TDocument>, UpdateOptions, CancellationToken)

Updates a single document.

UpdateOneAsync<TDocument>(IMongoCollection<TDocument>, Expression<Func<TDocument, bool>>, UpdateDefinition<TDocument>, UpdateOptions, CancellationToken)

Updates a single document.

UpdateOne<TDocument>(IMongoCollection<TDocument>, IClientSessionHandle, Expression<Func<TDocument, bool>>, UpdateDefinition<TDocument>, UpdateOptions, CancellationToken)

Updates a single document.

UpdateOne<TDocument>(IMongoCollection<TDocument>, Expression<Func<TDocument, bool>>, UpdateDefinition<TDocument>, UpdateOptions, CancellationToken)

Updates a single document.

WatchAsync<TDocument>(IMongoCollection<TDocument>, ChangeStreamOptions, CancellationToken)

Watches changes on the collection.

WatchAsync<TDocument>(IMongoCollection<TDocument>, IClientSessionHandle, ChangeStreamOptions, CancellationToken)

Watches changes on the collection.

Watch<TDocument>(IMongoCollection<TDocument>, ChangeStreamOptions, CancellationToken)

Watches changes on the collection.

Watch<TDocument>(IMongoCollection<TDocument>, IClientSessionHandle, ChangeStreamOptions, CancellationToken)

Watches changes on the collection.