Click or drag to resize

IChannelCommandTResult Method (ICoreSession, ReadPreference, DatabaseNamespace, BsonDocument, IEnumerableType1CommandMessageSection, IElementNameValidator, BsonDocument, ActionIMessageEncoderPostProcessor, CommandResponseHandling, IBsonSerializerTResult, MessageEncoderSettings, CancellationToken)

Executes a Command protocol.

Namespace:  MongoDB.Driver.Core.Bindings
Assembly:  MongoDB.Driver.Core (in MongoDB.Driver.Core.dll) Version: 2.9.0+32b058abcdf2c7e8d9dd3a676d207b31897eee2e
Syntax
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
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: TResult
The result of the Command protocol.
See Also