Table of Contents

Method Command

Namespace
MongoDB.Driver.Core.Bindings
Assembly
MongoDB.Driver.Core.dll

Command<TResult>(ICoreSession, ReadPreference, DatabaseNamespace, BsonDocument, IEnumerable<Type1CommandMessageSection>, IElementNameValidator, BsonDocument, Action<IMessageEncoderPostProcessor>, CommandResponseHandling, IBsonSerializer<TResult>, MessageEncoderSettings, CancellationToken)

Executes a Command protocol.

TResult Command<TResult>(ICoreSession session, ReadPreference readPreference, DatabaseNamespace databaseNamespace, BsonDocument command, IEnumerable<Type1CommandMessageSection> commandPayloads, IElementNameValidator commandValidator, BsonDocument additionalOptions, Action<IMessageEncoderPostProcessor> postWriteAction, CommandResponseHandling responseHandling, IBsonSerializer<TResult> resultSerializer, MessageEncoderSettings messageEncoderSettings, CancellationToken cancellationToken)

Parameters

session ICoreSession

The session.

readPreference ReadPreference

The read preference.

databaseNamespace DatabaseNamespace

The database namespace.

command BsonDocument

The command.

commandPayloads IEnumerable<Type1CommandMessageSection>

The command payloads.

commandValidator IElementNameValidator

The command validator.

additionalOptions BsonDocument

The additional options.

postWriteAction Action<IMessageEncoderPostProcessor>

The post write action.

responseHandling CommandResponseHandling

The response handling.

resultSerializer IBsonSerializer<TResult>

The result serializer.

messageEncoderSettings MessageEncoderSettings

The message encoder settings.

cancellationToken CancellationToken

The cancellation token.

Returns

TResult

The result of the Command protocol.

Type Parameters

TResult

The type of the result.