Click or drag to resize

IMongoDatabase Interface

Represents a database in MongoDB.

Namespace:  MongoDB.Driver
Assembly:  MongoDB.Driver (in MongoDB.Driver.dll) Version: 2.20.0+ee01960089f28ea1b501690df5fc9f6318a70242
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 methodAggregateTResult(PipelineDefinitionNoPipelineInput, TResult, AggregateOptions, CancellationToken)
Runs an aggregation pipeline.
Public methodAggregateTResult(IClientSessionHandle, PipelineDefinitionNoPipelineInput, TResult, AggregateOptions, CancellationToken)
Runs an aggregation pipeline.
Public methodAggregateAsyncTResult(PipelineDefinitionNoPipelineInput, TResult, AggregateOptions, CancellationToken)
Runs an aggregation pipeline.
Public methodAggregateAsyncTResult(IClientSessionHandle, PipelineDefinitionNoPipelineInput, TResult, AggregateOptions, CancellationToken)
Runs an aggregation pipeline.
Public methodAggregateToCollectionTResult(PipelineDefinitionNoPipelineInput, TResult, AggregateOptions, CancellationToken)
Runs an aggregation pipeline.
Public methodAggregateToCollectionTResult(IClientSessionHandle, PipelineDefinitionNoPipelineInput, TResult, AggregateOptions, CancellationToken)
Runs an aggregation pipeline.
Public methodAggregateToCollectionAsyncTResult(PipelineDefinitionNoPipelineInput, TResult, AggregateOptions, CancellationToken)
Runs an aggregation pipeline.
Public methodAggregateToCollectionAsyncTResult(IClientSessionHandle, PipelineDefinitionNoPipelineInput, 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 methodCreateViewTDocument, TResult(String, String, PipelineDefinitionTDocument, TResult, CreateViewOptionsTDocument, CancellationToken)
Creates a view.
Public methodCreateViewTDocument, TResult(IClientSessionHandle, String, String, PipelineDefinitionTDocument, TResult, CreateViewOptionsTDocument, CancellationToken)
Creates a view.
Public methodCreateViewAsyncTDocument, TResult(String, String, PipelineDefinitionTDocument, TResult, CreateViewOptionsTDocument, CancellationToken)
Creates a view.
Public methodCreateViewAsyncTDocument, TResult(IClientSessionHandle, String, String, PipelineDefinitionTDocument, TResult, CreateViewOptionsTDocument, CancellationToken)
Creates a view.
Public methodDropCollection(String, CancellationToken)
Drops the collection with the specified name.
Public methodDropCollection(String, DropCollectionOptions, CancellationToken)
Drops the collection with the specified name.
Public methodDropCollection(IClientSessionHandle, String, CancellationToken)
Drops the collection with the specified name.
Public methodDropCollection(IClientSessionHandle, String, DropCollectionOptions, CancellationToken)
Drops the collection with the specified name.
Public methodDropCollectionAsync(String, CancellationToken)
Drops the collection with the specified name.
Public methodDropCollectionAsync(String, DropCollectionOptions, CancellationToken)
Drops the collection with the specified name.
Public methodDropCollectionAsync(IClientSessionHandle, String, CancellationToken)
Drops the collection with the specified name.
Public methodDropCollectionAsync(IClientSessionHandle, String, DropCollectionOptions, CancellationToken)
Drops the collection with the specified name.
Public methodGetCollectionTDocument
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 methodRunCommandTResult(CommandTResult, ReadPreference, CancellationToken)
Runs a command.
Public methodRunCommandTResult(IClientSessionHandle, CommandTResult, ReadPreference, CancellationToken)
Runs a command.
Public methodRunCommandAsyncTResult(CommandTResult, ReadPreference, CancellationToken)
Runs a command.
Public methodRunCommandAsyncTResult(IClientSessionHandle, CommandTResult, ReadPreference, CancellationToken)
Runs a command.
Public methodWatchTResult(PipelineDefinitionChangeStreamDocumentBsonDocument, TResult, ChangeStreamOptions, CancellationToken)
Watches changes on all collections in a database.
Public methodWatchTResult(IClientSessionHandle, PipelineDefinitionChangeStreamDocumentBsonDocument, TResult, ChangeStreamOptions, CancellationToken)
Watches changes on all collections in a database.
Public methodWatchAsyncTResult(PipelineDefinitionChangeStreamDocumentBsonDocument, TResult, ChangeStreamOptions, CancellationToken)
Watches changes on all collections in a database.
Public methodWatchAsyncTResult(IClientSessionHandle, PipelineDefinitionChangeStreamDocumentBsonDocument, 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 MethodAsQueryable(AggregateOptions)Overloaded.
Creates a queryable source of documents.
(Defined by IMongoDatabaseExtensions.)
Public Extension MethodAsQueryable(IClientSessionHandle, AggregateOptions)Overloaded.
Creates a queryable source of documents.
(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