Table of Contents

Method RunCommandAs

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.Legacy.dll

RunCommandAs<TCommandResult>(IMongoCommand)

Runs a command on this database and returns the result as a TCommandResult.

public virtual TCommandResult RunCommandAs<TCommandResult>(IMongoCommand command) where TCommandResult : CommandResult

Parameters

command IMongoCommand

The command object.

Returns

TCommandResult

A TCommandResult

Type Parameters

TCommandResult

The type of the returned command result.

RunCommandAs<TCommandResult>(IMongoCommand, ReadPreference)

Runs a command on this database and returns the result as a TCommandResult.

public TCommandResult RunCommandAs<TCommandResult>(IMongoCommand command, ReadPreference readPreference) where TCommandResult : CommandResult

Parameters

command IMongoCommand

The command object.

readPreference ReadPreference

The read preference.

Returns

TCommandResult

A TCommandResult

Type Parameters

TCommandResult

The type of the returned command result.

RunCommandAs<TCommandResult>(string)

Runs a command on this database and returns the result as a TCommandResult.

public virtual TCommandResult RunCommandAs<TCommandResult>(string commandName) where TCommandResult : CommandResult

Parameters

commandName string

The name of the command.

Returns

TCommandResult

A TCommandResult

Type Parameters

TCommandResult

The type of the returned command result.

RunCommandAs(Type, IMongoCommand)

Runs a command on this database and returns the result as a TCommandResult.

public virtual CommandResult RunCommandAs(Type commandResultType, IMongoCommand command)

Parameters

commandResultType Type

The command result type.

command IMongoCommand

The command object.

Returns

CommandResult

A TCommandResult

RunCommandAs(Type, string)

Runs a command on this database and returns the result as a TCommandResult.

public virtual CommandResult RunCommandAs(Type commandResultType, string commandName)

Parameters

commandResultType Type

The command result type.

commandName string

The name of the command.

Returns

CommandResult

A TCommandResult