Click or drag to resize

IMongoDatabase Interface

Represents a database in MongoDB.

Namespace:  MongoDB.Driver
Assembly:  MongoDB.Driver (in MongoDB.Driver.dll) Version: 2.11.0+cb27a82ea70620ad1acad8058809be8302ae4f2a
Syntax
public interface IMongoDatabase

The IMongoDatabase type exposes the following members.

Properties
  NameDescription
Public propertyClient
Gets the client.
Public propertyDatabaseNamespace
Gets the namespace of the database.
Public propertySettings
Gets the settings.
Top
Methods
  NameDescription
Public methodAggregate<TResult>(PipelineDefinition<NoPipelineInput, TResult>, AggregateOptions, CancellationToken)
Runs an aggregation pipeline.
Public methodAggregate<TResult>(IClientSessionHandle, PipelineDefinition<NoPipelineInput, TResult>, AggregateOptions, CancellationToken)
Runs an aggregation pipeline.
Public methodAggregateAsync<TResult>(PipelineDefinition<NoPipelineInput, TResult>, AggregateOptions, CancellationToken)
Runs an aggregation pipeline.
Public methodAggregateAsync<TResult>(IClientSessionHandle, PipelineDefinition<NoPipelineInput, TResult>, AggregateOptions, CancellationToken)
Runs an aggregation pipeline.
Public methodAggregateToCollection<TResult>(PipelineDefinition<NoPipelineInput, TResult>, AggregateOptions, CancellationToken)
Runs an aggregation pipeline.
Public methodAggregateToCollection<TResult>(IClientSessionHandle, PipelineDefinition<NoPipelineInput, TResult>, AggregateOptions, CancellationToken)
Runs an aggregation pipeline.
Public methodAggregateToCollectionAsync<TResult>(PipelineDefinition<NoPipelineInput, TResult>, AggregateOptions, CancellationToken)
Runs an aggregation pipeline.
Public methodAggregateToCollectionAsync<TResult>(IClientSessionHandle, PipelineDefinition<NoPipelineInput, TResult>, AggregateOptions, CancellationToken)
Runs an aggregation pipeline.
Public methodCreateCollection(String, CreateCollectionOptions, CancellationToken)
Creates the collection with the specified name.
Public methodCreateCollection(IClientSessionHandle, String, CreateCollectionOptions, CancellationToken)
Creates the collection with the specified name.
Public methodCreateCollectionAsync(String, CreateCollectionOptions, CancellationToken)
Creates the collection with the specified name.
Public methodCreateCollectionAsync(IClientSessionHandle, String, CreateCollectionOptions, CancellationToken)
Creates the collection with the specified name.
Public methodCreateView<TDocument, TResult>(String, String, PipelineDefinition<TDocument, TResult>, CreateViewOptions<TDocument>, CancellationToken)
Creates a view.
Public methodCreateView<TDocument, TResult>(IClientSessionHandle, String, String, PipelineDefinition<TDocument, TResult>, CreateViewOptions<TDocument>, CancellationToken)
Creates a view.
Public methodCreateViewAsync<TDocument, TResult>(String, String, PipelineDefinition<TDocument, TResult>, CreateViewOptions<TDocument>, CancellationToken)
Creates a view.
Public methodCreateViewAsync<TDocument, TResult>(IClientSessionHandle, String, String, PipelineDefinition<TDocument, TResult>, CreateViewOptions<TDocument>, CancellationToken)
Creates a view.
Public methodDropCollection(String, CancellationToken)
Drops the collection with the specified name.
Public methodDropCollection(IClientSessionHandle, String, CancellationToken)
Drops the collection with the specified name.
Public methodDropCollectionAsync(String, CancellationToken)
Drops the collection with the specified name.
Public methodDropCollectionAsync(IClientSessionHandle, String, CancellationToken)
Drops the collection with the specified name.
Public methodGetCollection<TDocument>
Gets a collection.
Public methodListCollectionNames(ListCollectionNamesOptions, CancellationToken)
Lists the names of all the collections in the database.
Public methodListCollectionNames(IClientSessionHandle, ListCollectionNamesOptions, CancellationToken)
Lists the names of all the collections in the database.
Public methodListCollectionNamesAsync(ListCollectionNamesOptions, CancellationToken)
Lists the names of all the collections in the database.
Public methodListCollectionNamesAsync(IClientSessionHandle, ListCollectionNamesOptions, CancellationToken)
Lists the names of all the collections in the database.
Public methodListCollections(ListCollectionsOptions, CancellationToken)
Lists all the collections in the database.
Public methodListCollections(IClientSessionHandle, ListCollectionsOptions, CancellationToken)
Lists all the collections in the database.
Public methodListCollectionsAsync(ListCollectionsOptions, CancellationToken)
Lists all the collections in the database.
Public methodListCollectionsAsync(IClientSessionHandle, ListCollectionsOptions, CancellationToken)
Lists all the collections in the database.
Public methodRenameCollection(String, String, RenameCollectionOptions, CancellationToken)
Renames the collection.
Public methodRenameCollection(IClientSessionHandle, String, String, RenameCollectionOptions, CancellationToken)
Renames the collection.
Public methodRenameCollectionAsync(String, String, RenameCollectionOptions, CancellationToken)
Renames the collection.
Public methodRenameCollectionAsync(IClientSessionHandle, String, String, RenameCollectionOptions, CancellationToken)
Renames the collection.
Public methodRunCommand<TResult>(Command<TResult>, ReadPreference, CancellationToken)
Runs a command.
Public methodRunCommand<TResult>(IClientSessionHandle, Command<TResult>, ReadPreference, CancellationToken)
Runs a command.
Public methodRunCommandAsync<TResult>(Command<TResult>, ReadPreference, CancellationToken)
Runs a command.
Public methodRunCommandAsync<TResult>(IClientSessionHandle, Command<TResult>, ReadPreference, CancellationToken)
Runs a command.
Public methodWatch<TResult>(PipelineDefinition<ChangeStreamDocument<BsonDocument>, TResult>, ChangeStreamOptions, CancellationToken)
Watches changes on all collections in a database.
Public methodWatch<TResult>(IClientSessionHandle, PipelineDefinition<ChangeStreamDocument<BsonDocument>, TResult>, ChangeStreamOptions, CancellationToken)
Watches changes on all collections in a database.
Public methodWatchAsync<TResult>(PipelineDefinition<ChangeStreamDocument<BsonDocument>, TResult>, ChangeStreamOptions, CancellationToken)
Watches changes on all collections in a database.
Public methodWatchAsync<TResult>(IClientSessionHandle, PipelineDefinition<ChangeStreamDocument<BsonDocument>, TResult>, ChangeStreamOptions, CancellationToken)
Watches changes on all collections in a database.
Public methodWithReadConcern
Returns a new IMongoDatabase instance with a different read concern setting.
Public methodWithReadPreference
Returns a new IMongoDatabase instance with a different read preference setting.
Public methodWithWriteConcern
Returns a new IMongoDatabase instance with a different write concern setting.
Top
Extension Methods
  NameDescription
Public Extension MethodAggregate(AggregateOptions)Overloaded.
Begins a fluent aggregation interface.
(Defined by IMongoDatabaseExtensions.)
Public Extension MethodAggregate(IClientSessionHandle, AggregateOptions)Overloaded.
Begins a fluent aggregation interface.
(Defined by IMongoDatabaseExtensions.)
Public Extension MethodWatch(ChangeStreamOptions, CancellationToken)Overloaded.
Watches changes on all collection in a database.
(Defined by IMongoDatabaseExtensions.)
Public Extension MethodWatch(IClientSessionHandle, ChangeStreamOptions, CancellationToken)Overloaded.
Watches changes on all collection in a database.
(Defined by IMongoDatabaseExtensions.)
Public Extension MethodWatchAsync(ChangeStreamOptions, CancellationToken)Overloaded.
Watches changes on all collection in a database.
(Defined by IMongoDatabaseExtensions.)
Public Extension MethodWatchAsync(IClientSessionHandle, ChangeStreamOptions, CancellationToken)Overloaded.
Watches changes on all collection in a database.
(Defined by IMongoDatabaseExtensions.)
Top
Remarks
This interface is not guaranteed to remain stable. Implementors should use MongoDatabaseBase.
See Also