Interface IMongoDatabase
Represents a database in MongoDB.
public interface IMongoDatabase
- Extension Methods
Remarks
This interface is not guaranteed to remain stable. Implementors should use MongoDatabaseBase.
Properties
Client
Gets the client.
IMongoClient Client { get; }
Property Value
DatabaseNamespace
Gets the namespace of the database.
DatabaseNamespace DatabaseNamespace { get; }
Property Value
Settings
Gets the settings.
MongoDatabaseSettings Settings { get; }
Property Value
Methods
AggregateAsync<TResult>(IClientSessionHandle, PipelineDefinition<NoPipelineInput, TResult>, AggregateOptions, CancellationToken)
Runs an aggregation pipeline.
Task<IAsyncCursor<TResult>> AggregateAsync<TResult>(IClientSessionHandle session, PipelineDefinition<NoPipelineInput, TResult> pipeline, AggregateOptions options = null, CancellationToken cancellationToken = default)
Parameters
sessionIClientSessionHandleThe session.
pipelinePipelineDefinition<NoPipelineInput, TResult>The pipeline.
optionsAggregateOptionsThe options.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task<IAsyncCursor<TResult>>
A Task whose result is a cursor.
Type Parameters
TResultThe type of the result.
AggregateAsync<TResult>(PipelineDefinition<NoPipelineInput, TResult>, AggregateOptions, CancellationToken)
Runs an aggregation pipeline.
Task<IAsyncCursor<TResult>> AggregateAsync<TResult>(PipelineDefinition<NoPipelineInput, TResult> pipeline, AggregateOptions options = null, CancellationToken cancellationToken = default)
Parameters
pipelinePipelineDefinition<NoPipelineInput, TResult>The pipeline.
optionsAggregateOptionsThe options.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task<IAsyncCursor<TResult>>
A Task whose result is a cursor.
Type Parameters
TResultThe type of the result.
AggregateToCollectionAsync<TResult>(IClientSessionHandle, PipelineDefinition<NoPipelineInput, TResult>, AggregateOptions, CancellationToken)
Runs an aggregation pipeline.
Task AggregateToCollectionAsync<TResult>(IClientSessionHandle session, PipelineDefinition<NoPipelineInput, TResult> pipeline, AggregateOptions options = null, CancellationToken cancellationToken = default)
Parameters
sessionIClientSessionHandleThe session.
pipelinePipelineDefinition<NoPipelineInput, TResult>The pipeline.
optionsAggregateOptionsThe options.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task
A Task.
Type Parameters
TResultThe type of the result.
AggregateToCollectionAsync<TResult>(PipelineDefinition<NoPipelineInput, TResult>, AggregateOptions, CancellationToken)
Runs an aggregation pipeline.
Task AggregateToCollectionAsync<TResult>(PipelineDefinition<NoPipelineInput, TResult> pipeline, AggregateOptions options = null, CancellationToken cancellationToken = default)
Parameters
pipelinePipelineDefinition<NoPipelineInput, TResult>The pipeline.
optionsAggregateOptionsThe options.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task
A Task.
Type Parameters
TResultThe type of the result.
AggregateToCollection<TResult>(IClientSessionHandle, PipelineDefinition<NoPipelineInput, TResult>, AggregateOptions, CancellationToken)
Runs an aggregation pipeline.
void AggregateToCollection<TResult>(IClientSessionHandle session, PipelineDefinition<NoPipelineInput, TResult> pipeline, AggregateOptions options = null, CancellationToken cancellationToken = default)
Parameters
sessionIClientSessionHandleThe session.
pipelinePipelineDefinition<NoPipelineInput, TResult>The pipeline.
optionsAggregateOptionsThe options.
cancellationTokenCancellationTokenThe cancellation token.
Type Parameters
TResultThe type of the result.
AggregateToCollection<TResult>(PipelineDefinition<NoPipelineInput, TResult>, AggregateOptions, CancellationToken)
Runs an aggregation pipeline.
void AggregateToCollection<TResult>(PipelineDefinition<NoPipelineInput, TResult> pipeline, AggregateOptions options = null, CancellationToken cancellationToken = default)
Parameters
pipelinePipelineDefinition<NoPipelineInput, TResult>The pipeline.
optionsAggregateOptionsThe options.
cancellationTokenCancellationTokenThe cancellation token.
Type Parameters
TResultThe type of the result.
Aggregate<TResult>(IClientSessionHandle, PipelineDefinition<NoPipelineInput, TResult>, AggregateOptions, CancellationToken)
Runs an aggregation pipeline.
IAsyncCursor<TResult> Aggregate<TResult>(IClientSessionHandle session, PipelineDefinition<NoPipelineInput, TResult> pipeline, AggregateOptions options = null, CancellationToken cancellationToken = default)
Parameters
sessionIClientSessionHandleThe session.
pipelinePipelineDefinition<NoPipelineInput, TResult>The pipeline.
optionsAggregateOptionsThe options.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- IAsyncCursor<TResult>
A cursor.
Type Parameters
TResultThe type of the result.
Aggregate<TResult>(PipelineDefinition<NoPipelineInput, TResult>, AggregateOptions, CancellationToken)
Runs an aggregation pipeline.
IAsyncCursor<TResult> Aggregate<TResult>(PipelineDefinition<NoPipelineInput, TResult> pipeline, AggregateOptions options = null, CancellationToken cancellationToken = default)
Parameters
pipelinePipelineDefinition<NoPipelineInput, TResult>The pipeline.
optionsAggregateOptionsThe options.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- IAsyncCursor<TResult>
A cursor.
Type Parameters
TResultThe type of the result.
CreateCollection(IClientSessionHandle, string, CreateCollectionOptions, CancellationToken)
Creates the collection with the specified name.
void CreateCollection(IClientSessionHandle session, string name, CreateCollectionOptions options = null, CancellationToken cancellationToken = default)
Parameters
sessionIClientSessionHandleThe session.
namestringThe name.
optionsCreateCollectionOptionsThe options.
cancellationTokenCancellationTokenThe cancellation token.
CreateCollection(string, CreateCollectionOptions, CancellationToken)
Creates the collection with the specified name.
void CreateCollection(string name, CreateCollectionOptions options = null, CancellationToken cancellationToken = default)
Parameters
namestringThe name.
optionsCreateCollectionOptionsThe options.
cancellationTokenCancellationTokenThe cancellation token.
CreateCollectionAsync(IClientSessionHandle, string, CreateCollectionOptions, CancellationToken)
Creates the collection with the specified name.
Task CreateCollectionAsync(IClientSessionHandle session, string name, CreateCollectionOptions options = null, CancellationToken cancellationToken = default)
Parameters
sessionIClientSessionHandleThe session.
namestringThe name.
optionsCreateCollectionOptionsThe options.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task
A task.
CreateCollectionAsync(string, CreateCollectionOptions, CancellationToken)
Creates the collection with the specified name.
Task CreateCollectionAsync(string name, CreateCollectionOptions options = null, CancellationToken cancellationToken = default)
Parameters
namestringThe name.
optionsCreateCollectionOptionsThe options.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task
A task.
CreateViewAsync<TDocument, TResult>(IClientSessionHandle, string, string, PipelineDefinition<TDocument, TResult>, CreateViewOptions<TDocument>, CancellationToken)
Creates a view.
Task CreateViewAsync<TDocument, TResult>(IClientSessionHandle session, string viewName, string viewOn, PipelineDefinition<TDocument, TResult> pipeline, CreateViewOptions<TDocument> options = null, CancellationToken cancellationToken = default)
Parameters
sessionIClientSessionHandleThe session.
viewNamestringThe name of the view.
viewOnstringThe name of the collection that the view is on.
pipelinePipelineDefinition<TDocument, TResult>The pipeline.
optionsCreateViewOptions<TDocument>The options.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task
A task.
Type Parameters
TDocumentThe type of the input documents.
TResultThe type of the pipeline result documents.
CreateViewAsync<TDocument, TResult>(string, string, PipelineDefinition<TDocument, TResult>, CreateViewOptions<TDocument>, CancellationToken)
Creates a view.
Task CreateViewAsync<TDocument, TResult>(string viewName, string viewOn, PipelineDefinition<TDocument, TResult> pipeline, CreateViewOptions<TDocument> options = null, CancellationToken cancellationToken = default)
Parameters
viewNamestringThe name of the view.
viewOnstringThe name of the collection that the view is on.
pipelinePipelineDefinition<TDocument, TResult>The pipeline.
optionsCreateViewOptions<TDocument>The options.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task
A task.
Type Parameters
TDocumentThe type of the input documents.
TResultThe type of the pipeline result documents.
CreateView<TDocument, TResult>(IClientSessionHandle, string, string, PipelineDefinition<TDocument, TResult>, CreateViewOptions<TDocument>, CancellationToken)
Creates a view.
void CreateView<TDocument, TResult>(IClientSessionHandle session, string viewName, string viewOn, PipelineDefinition<TDocument, TResult> pipeline, CreateViewOptions<TDocument> options = null, CancellationToken cancellationToken = default)
Parameters
sessionIClientSessionHandleThe session.
viewNamestringThe name of the view.
viewOnstringThe name of the collection that the view is on.
pipelinePipelineDefinition<TDocument, TResult>The pipeline.
optionsCreateViewOptions<TDocument>The options.
cancellationTokenCancellationTokenThe cancellation token.
Type Parameters
TDocumentThe type of the input documents.
TResultThe type of the pipeline result documents.
CreateView<TDocument, TResult>(string, string, PipelineDefinition<TDocument, TResult>, CreateViewOptions<TDocument>, CancellationToken)
Creates a view.
void CreateView<TDocument, TResult>(string viewName, string viewOn, PipelineDefinition<TDocument, TResult> pipeline, CreateViewOptions<TDocument> options = null, CancellationToken cancellationToken = default)
Parameters
viewNamestringThe name of the view.
viewOnstringThe name of the collection that the view is on.
pipelinePipelineDefinition<TDocument, TResult>The pipeline.
optionsCreateViewOptions<TDocument>The options.
cancellationTokenCancellationTokenThe cancellation token.
Type Parameters
TDocumentThe type of the input documents.
TResultThe type of the pipeline result documents.
DropCollection(IClientSessionHandle, string, DropCollectionOptions, CancellationToken)
Drops the collection with the specified name.
void DropCollection(IClientSessionHandle session, string name, DropCollectionOptions options, CancellationToken cancellationToken = default)
Parameters
sessionIClientSessionHandleThe session.
namestringThe name of the collection to drop.
optionsDropCollectionOptionsThe options.
cancellationTokenCancellationTokenThe cancellation token.
DropCollection(IClientSessionHandle, string, CancellationToken)
Drops the collection with the specified name.
void DropCollection(IClientSessionHandle session, string name, CancellationToken cancellationToken = default)
Parameters
sessionIClientSessionHandleThe session.
namestringThe name of the collection to drop.
cancellationTokenCancellationTokenThe cancellation token.
DropCollection(string, DropCollectionOptions, CancellationToken)
Drops the collection with the specified name.
void DropCollection(string name, DropCollectionOptions options, CancellationToken cancellationToken = default)
Parameters
namestringThe name of the collection to drop.
optionsDropCollectionOptionsThe options.
cancellationTokenCancellationTokenThe cancellation token.
DropCollection(string, CancellationToken)
Drops the collection with the specified name.
void DropCollection(string name, CancellationToken cancellationToken = default)
Parameters
namestringThe name of the collection to drop.
cancellationTokenCancellationTokenThe cancellation token.
DropCollectionAsync(IClientSessionHandle, string, DropCollectionOptions, CancellationToken)
Drops the collection with the specified name.
Task DropCollectionAsync(IClientSessionHandle session, string name, DropCollectionOptions options, CancellationToken cancellationToken = default)
Parameters
sessionIClientSessionHandleThe session.
namestringThe name of the collection to drop.
optionsDropCollectionOptionsThe options.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task
A task.
DropCollectionAsync(IClientSessionHandle, string, CancellationToken)
Drops the collection with the specified name.
Task DropCollectionAsync(IClientSessionHandle session, string name, CancellationToken cancellationToken = default)
Parameters
sessionIClientSessionHandleThe session.
namestringThe name of the collection to drop.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task
A task.
DropCollectionAsync(string, DropCollectionOptions, CancellationToken)
Drops the collection with the specified name.
Task DropCollectionAsync(string name, DropCollectionOptions options, CancellationToken cancellationToken = default)
Parameters
namestringThe name of the collection to drop.
optionsDropCollectionOptionsThe options.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task
A task.
DropCollectionAsync(string, CancellationToken)
Drops the collection with the specified name.
Task DropCollectionAsync(string name, CancellationToken cancellationToken = default)
Parameters
namestringThe name of the collection to drop.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task
A task.
GetCollection<TDocument>(string, MongoCollectionSettings)
Gets a collection.
IMongoCollection<TDocument> GetCollection<TDocument>(string name, MongoCollectionSettings settings = null)
Parameters
namestringThe name of the collection.
settingsMongoCollectionSettingsThe settings.
Returns
- IMongoCollection<TDocument>
An implementation of a collection.
Type Parameters
TDocumentThe document type.
ListCollectionNames(IClientSessionHandle, ListCollectionNamesOptions, CancellationToken)
Lists the names of all the collections in the database.
IAsyncCursor<string> ListCollectionNames(IClientSessionHandle session, ListCollectionNamesOptions options = null, CancellationToken cancellationToken = default)
Parameters
sessionIClientSessionHandleThe session.
optionsListCollectionNamesOptionsThe options.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- IAsyncCursor<string>
A cursor.
ListCollectionNames(ListCollectionNamesOptions, CancellationToken)
Lists the names of all the collections in the database.
IAsyncCursor<string> ListCollectionNames(ListCollectionNamesOptions options = null, CancellationToken cancellationToken = default)
Parameters
optionsListCollectionNamesOptionsThe options.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- IAsyncCursor<string>
A cursor.
ListCollectionNamesAsync(IClientSessionHandle, ListCollectionNamesOptions, CancellationToken)
Lists the names of all the collections in the database.
Task<IAsyncCursor<string>> ListCollectionNamesAsync(IClientSessionHandle session, ListCollectionNamesOptions options = null, CancellationToken cancellationToken = default)
Parameters
sessionIClientSessionHandleThe session.
optionsListCollectionNamesOptionsThe options.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task<IAsyncCursor<string>>
A Task whose result is a cursor.
ListCollectionNamesAsync(ListCollectionNamesOptions, CancellationToken)
Lists the names of all the collections in the database.
Task<IAsyncCursor<string>> ListCollectionNamesAsync(ListCollectionNamesOptions options = null, CancellationToken cancellationToken = default)
Parameters
optionsListCollectionNamesOptionsThe options.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task<IAsyncCursor<string>>
A Task whose result is a cursor.
ListCollections(IClientSessionHandle, ListCollectionsOptions, CancellationToken)
Lists all the collections in the database.
IAsyncCursor<BsonDocument> ListCollections(IClientSessionHandle session, ListCollectionsOptions options = null, CancellationToken cancellationToken = default)
Parameters
sessionIClientSessionHandleThe session.
optionsListCollectionsOptionsThe options.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- IAsyncCursor<BsonDocument>
A cursor.
ListCollections(ListCollectionsOptions, CancellationToken)
Lists all the collections in the database.
IAsyncCursor<BsonDocument> ListCollections(ListCollectionsOptions options = null, CancellationToken cancellationToken = default)
Parameters
optionsListCollectionsOptionsThe options.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- IAsyncCursor<BsonDocument>
A cursor.
ListCollectionsAsync(IClientSessionHandle, ListCollectionsOptions, CancellationToken)
Lists all the collections in the database.
Task<IAsyncCursor<BsonDocument>> ListCollectionsAsync(IClientSessionHandle session, ListCollectionsOptions options = null, CancellationToken cancellationToken = default)
Parameters
sessionIClientSessionHandleThe session.
optionsListCollectionsOptionsThe options.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task<IAsyncCursor<BsonDocument>>
A Task whose result is a cursor.
ListCollectionsAsync(ListCollectionsOptions, CancellationToken)
Lists all the collections in the database.
Task<IAsyncCursor<BsonDocument>> ListCollectionsAsync(ListCollectionsOptions options = null, CancellationToken cancellationToken = default)
Parameters
optionsListCollectionsOptionsThe options.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task<IAsyncCursor<BsonDocument>>
A Task whose result is a cursor.
RenameCollection(IClientSessionHandle, string, string, RenameCollectionOptions, CancellationToken)
Renames the collection.
void RenameCollection(IClientSessionHandle session, string oldName, string newName, RenameCollectionOptions options = null, CancellationToken cancellationToken = default)
Parameters
sessionIClientSessionHandleThe session.
oldNamestringThe old name.
newNamestringThe new name.
optionsRenameCollectionOptionsThe options.
cancellationTokenCancellationTokenThe cancellation token.
RenameCollection(string, string, RenameCollectionOptions, CancellationToken)
Renames the collection.
void RenameCollection(string oldName, string newName, RenameCollectionOptions options = null, CancellationToken cancellationToken = default)
Parameters
oldNamestringThe old name.
newNamestringThe new name.
optionsRenameCollectionOptionsThe options.
cancellationTokenCancellationTokenThe cancellation token.
RenameCollectionAsync(IClientSessionHandle, string, string, RenameCollectionOptions, CancellationToken)
Renames the collection.
Task RenameCollectionAsync(IClientSessionHandle session, string oldName, string newName, RenameCollectionOptions options = null, CancellationToken cancellationToken = default)
Parameters
sessionIClientSessionHandleThe session.
oldNamestringThe old name.
newNamestringThe new name.
optionsRenameCollectionOptionsThe options.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task
A task.
RenameCollectionAsync(string, string, RenameCollectionOptions, CancellationToken)
Renames the collection.
Task RenameCollectionAsync(string oldName, string newName, RenameCollectionOptions options = null, CancellationToken cancellationToken = default)
Parameters
oldNamestringThe old name.
newNamestringThe new name.
optionsRenameCollectionOptionsThe options.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task
A task.
RunCommandAsync<TResult>(Command<TResult>, ReadPreference, CancellationToken)
Runs a command.
Task<TResult> RunCommandAsync<TResult>(Command<TResult> command, ReadPreference readPreference = null, CancellationToken cancellationToken = default)
Parameters
commandCommand<TResult>The command.
readPreferenceReadPreferenceThe read preference.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task<TResult>
The result of the command.
Type Parameters
TResultThe result type of the command.
RunCommandAsync<TResult>(IClientSessionHandle, Command<TResult>, ReadPreference, CancellationToken)
Runs a command.
Task<TResult> RunCommandAsync<TResult>(IClientSessionHandle session, Command<TResult> command, ReadPreference readPreference = null, CancellationToken cancellationToken = default)
Parameters
sessionIClientSessionHandleThe session.
commandCommand<TResult>The command.
readPreferenceReadPreferenceThe read preference.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task<TResult>
The result of the command.
Type Parameters
TResultThe result type of the command.
RunCommand<TResult>(Command<TResult>, ReadPreference, CancellationToken)
Runs a command.
TResult RunCommand<TResult>(Command<TResult> command, ReadPreference readPreference = null, CancellationToken cancellationToken = default)
Parameters
commandCommand<TResult>The command.
readPreferenceReadPreferenceThe read preference.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- TResult
The result of the command.
Type Parameters
TResultThe result type of the command.
RunCommand<TResult>(IClientSessionHandle, Command<TResult>, ReadPreference, CancellationToken)
Runs a command.
TResult RunCommand<TResult>(IClientSessionHandle session, Command<TResult> command, ReadPreference readPreference = null, CancellationToken cancellationToken = default)
Parameters
sessionIClientSessionHandleThe session.
commandCommand<TResult>The command.
readPreferenceReadPreferenceThe read preference.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- TResult
The result of the command.
Type Parameters
TResultThe result type of the command.
WatchAsync<TResult>(IClientSessionHandle, PipelineDefinition<ChangeStreamDocument<BsonDocument>, TResult>, ChangeStreamOptions, CancellationToken)
Watches changes on all collections in a database.
Task<IChangeStreamCursor<TResult>> WatchAsync<TResult>(IClientSessionHandle session, PipelineDefinition<ChangeStreamDocument<BsonDocument>, TResult> pipeline, ChangeStreamOptions options = null, CancellationToken cancellationToken = default)
Parameters
sessionIClientSessionHandleThe session.
pipelinePipelineDefinition<ChangeStreamDocument<BsonDocument>, TResult>The pipeline.
optionsChangeStreamOptionsThe options.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task<IChangeStreamCursor<TResult>>
A change stream.
Type Parameters
TResultThe type of the result.
WatchAsync<TResult>(PipelineDefinition<ChangeStreamDocument<BsonDocument>, TResult>, ChangeStreamOptions, CancellationToken)
Watches changes on all collections in a database.
Task<IChangeStreamCursor<TResult>> WatchAsync<TResult>(PipelineDefinition<ChangeStreamDocument<BsonDocument>, TResult> pipeline, ChangeStreamOptions options = null, CancellationToken cancellationToken = default)
Parameters
pipelinePipelineDefinition<ChangeStreamDocument<BsonDocument>, TResult>The pipeline.
optionsChangeStreamOptionsThe options.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task<IChangeStreamCursor<TResult>>
A change stream.
Type Parameters
TResultThe type of the result.
Watch<TResult>(IClientSessionHandle, PipelineDefinition<ChangeStreamDocument<BsonDocument>, TResult>, ChangeStreamOptions, CancellationToken)
Watches changes on all collections in a database.
IChangeStreamCursor<TResult> Watch<TResult>(IClientSessionHandle session, PipelineDefinition<ChangeStreamDocument<BsonDocument>, TResult> pipeline, ChangeStreamOptions options = null, CancellationToken cancellationToken = default)
Parameters
sessionIClientSessionHandleThe session.
pipelinePipelineDefinition<ChangeStreamDocument<BsonDocument>, TResult>The pipeline.
optionsChangeStreamOptionsThe options.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- IChangeStreamCursor<TResult>
A change stream.
Type Parameters
TResultThe type of the result.
Watch<TResult>(PipelineDefinition<ChangeStreamDocument<BsonDocument>, TResult>, ChangeStreamOptions, CancellationToken)
Watches changes on all collections in a database.
IChangeStreamCursor<TResult> Watch<TResult>(PipelineDefinition<ChangeStreamDocument<BsonDocument>, TResult> pipeline, ChangeStreamOptions options = null, CancellationToken cancellationToken = default)
Parameters
pipelinePipelineDefinition<ChangeStreamDocument<BsonDocument>, TResult>The pipeline.
optionsChangeStreamOptionsThe options.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- IChangeStreamCursor<TResult>
A change stream.
Type Parameters
TResultThe type of the result.
WithReadConcern(ReadConcern)
Returns a new IMongoDatabase instance with a different read concern setting.
IMongoDatabase WithReadConcern(ReadConcern readConcern)
Parameters
readConcernReadConcernThe read concern.
Returns
- IMongoDatabase
A new IMongoDatabase instance with a different read concern setting.
WithReadPreference(ReadPreference)
Returns a new IMongoDatabase instance with a different read preference setting.
IMongoDatabase WithReadPreference(ReadPreference readPreference)
Parameters
readPreferenceReadPreferenceThe read preference.
Returns
- IMongoDatabase
A new IMongoDatabase instance with a different read preference setting.
WithWriteConcern(WriteConcern)
Returns a new IMongoDatabase instance with a different write concern setting.
IMongoDatabase WithWriteConcern(WriteConcern writeConcern)
Parameters
writeConcernWriteConcernThe write concern.
Returns
- IMongoDatabase
A new IMongoDatabase instance with a different write concern setting.