Click or drag to resize

IChannelCommandAsyncTResult Method

Executes a Command protocol.

Namespace:  MongoDB.Driver.Core.Bindings
Assembly:  MongoDB.Driver.Core (in MongoDB.Driver.Core.dll) Version: 2.22.0+75246110ed1247226fcc7f8eb2c54ffab745693e
Syntax
Task<TResult> CommandAsync<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
Type: MongoDB.Driver.Core.BindingsICoreSession
The session.
readPreference
Type: MongoDB.DriverReadPreference
The read preference.
databaseNamespace
Type: MongoDB.DriverDatabaseNamespace
The database namespace.
command
Type: MongoDB.BsonBsonDocument
The command.
commandPayloads
Type: System.Collections.GenericIEnumerableType1CommandMessageSection
The command payloads.
commandValidator
Type: MongoDB.Bson.IOIElementNameValidator
The command validator.
additionalOptions
Type: MongoDB.BsonBsonDocument
The additional options.
postWriteAction
Type: SystemActionIMessageEncoderPostProcessor
The post write action.
responseHandling
Type: MongoDB.Driver.Core.WireProtocolCommandResponseHandling
The response handling.
resultSerializer
Type: MongoDB.Bson.SerializationIBsonSerializerTResult
The result serializer.
messageEncoderSettings
Type: MongoDB.Driver.Core.WireProtocol.Messages.EncodersMessageEncoderSettings
The message encoder settings.
cancellationToken
Type: System.ThreadingCancellationToken
The cancellation token.

Type Parameters

TResult
The type of the result.

Return Value

Type: TaskTResult
A Task whose result is the result of the Command protocol.
See Also