Table of Contents

Class IMongoDatabaseExtensions

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.dll

Extension methods on IMongoDatabase.

public static class IMongoDatabaseExtensions
Inheritance
IMongoDatabaseExtensions
Inherited Members

Methods

Aggregate(IMongoDatabase, AggregateOptions)

Begins a fluent aggregation interface.

public static IAggregateFluent<NoPipelineInput> Aggregate(this IMongoDatabase database, AggregateOptions options = null)

Parameters

database IMongoDatabase

The database.

options AggregateOptions

The options.

Returns

IAggregateFluent<NoPipelineInput>

A fluent aggregate interface.

Aggregate(IMongoDatabase, IClientSessionHandle, AggregateOptions)

Begins a fluent aggregation interface.

public static IAggregateFluent<NoPipelineInput> Aggregate(this IMongoDatabase database, IClientSessionHandle session, AggregateOptions options = null)

Parameters

database IMongoDatabase

The database.

session IClientSessionHandle

The session.

options AggregateOptions

The options.

Returns

IAggregateFluent<NoPipelineInput>

A fluent aggregate interface.

AsQueryable(IMongoDatabase, AggregateOptions)

Creates a queryable source of documents.

public static IMongoQueryable<NoPipelineInput> AsQueryable(this IMongoDatabase database, AggregateOptions aggregateOptions = null)

Parameters

database IMongoDatabase

The database.

aggregateOptions AggregateOptions

The aggregate options

Returns

IMongoQueryable<NoPipelineInput>

A queryable source of documents.

AsQueryable(IMongoDatabase, IClientSessionHandle, AggregateOptions)

Creates a queryable source of documents.

public static IMongoQueryable<NoPipelineInput> AsQueryable(this IMongoDatabase database, IClientSessionHandle session, AggregateOptions aggregateOptions = null)

Parameters

database IMongoDatabase

The collection.

session IClientSessionHandle

The session.

aggregateOptions AggregateOptions

The aggregate options

Returns

IMongoQueryable<NoPipelineInput>

A queryable source of documents.

Watch(IMongoDatabase, ChangeStreamOptions, CancellationToken)

Watches changes on all collection in a database.

public static IChangeStreamCursor<ChangeStreamDocument<BsonDocument>> Watch(this IMongoDatabase database, ChangeStreamOptions options = null, CancellationToken cancellationToken = default)

Parameters

database IMongoDatabase

The database.

options ChangeStreamOptions

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

IChangeStreamCursor<ChangeStreamDocument<BsonDocument>>

A change stream.

Watch(IMongoDatabase, IClientSessionHandle, ChangeStreamOptions, CancellationToken)

Watches changes on all collection in a database.

public static IChangeStreamCursor<ChangeStreamDocument<BsonDocument>> Watch(this IMongoDatabase database, IClientSessionHandle session, ChangeStreamOptions options = null, CancellationToken cancellationToken = default)

Parameters

database IMongoDatabase

The database.

session IClientSessionHandle

The session.

options ChangeStreamOptions

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

IChangeStreamCursor<ChangeStreamDocument<BsonDocument>>

A change stream.

WatchAsync(IMongoDatabase, ChangeStreamOptions, CancellationToken)

Watches changes on all collection in a database.

public static Task<IChangeStreamCursor<ChangeStreamDocument<BsonDocument>>> WatchAsync(this IMongoDatabase database, ChangeStreamOptions options = null, CancellationToken cancellationToken = default)

Parameters

database IMongoDatabase

The database.

options ChangeStreamOptions

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<IChangeStreamCursor<ChangeStreamDocument<BsonDocument>>>

A change stream.

WatchAsync(IMongoDatabase, IClientSessionHandle, ChangeStreamOptions, CancellationToken)

Watches changes on all collection in a database.

public static Task<IChangeStreamCursor<ChangeStreamDocument<BsonDocument>>> WatchAsync(this IMongoDatabase database, IClientSessionHandle session, ChangeStreamOptions options = null, CancellationToken cancellationToken = default)

Parameters

database IMongoDatabase

The database.

session IClientSessionHandle

The session.

options ChangeStreamOptions

The options.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<IChangeStreamCursor<ChangeStreamDocument<BsonDocument>>>

A change stream.