Method RunCommand
RunCommand<TResult>(Command<TResult>, ReadPreference, CancellationToken)
Runs a command.
public virtual TResult RunCommand<TResult>(Command<TResult> command, ReadPreference readPreference = null, CancellationToken cancellationToken = default)
Parameters
command
Command<TResult>The command.
readPreference
ReadPreferenceThe read preference.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- TResult
The result of the command.
Type Parameters
TResult
The result type of the command.
RunCommand<TResult>(IClientSessionHandle, Command<TResult>, ReadPreference, CancellationToken)
Runs a command.
public virtual TResult RunCommand<TResult>(IClientSessionHandle session, Command<TResult> command, ReadPreference readPreference = null, CancellationToken cancellationToken = default)
Parameters
session
IClientSessionHandleThe session.
command
Command<TResult>The command.
readPreference
ReadPreferenceThe read preference.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- TResult
The result of the command.
Type Parameters
TResult
The result type of the command.