Documentation

DatabaseCommand
in package

FinalYes

Operation for executing a database command.

Tags
see
Database::command()

Table of Contents

Properties

$command  : Command
$databaseName  : string
$options  : array<string|int, mixed>

Methods

__construct()  : mixed
Constructs a command.
execute()  : CursorInterface
createOptions()  : array<string|int, mixed>
Create options for executing the command.

Properties

Methods

__construct()

Constructs a command.

public __construct(string $databaseName, array<string|int, mixed>|object $command[, array<string|int, mixed> $options = [] ]) : mixed

Supported options:

  • readPreference (MongoDB\Driver\ReadPreference): The read preference to use when executing the command. This may be used when issuing the command to a replica set or mongos node to ensure that the driver sets the wire protocol accordingly or adds the read preference to the command document, respectively.

  • session (MongoDB\Driver\Session): Client session.

  • typeMap (array): Type map for BSON deserialization. This will be applied to the returned Cursor (it is not sent to the server).

Parameters
$databaseName : string

Database name

$command : array<string|int, mixed>|object

Command document

$options : array<string|int, mixed> = []

Options for command execution

Tags
throws
InvalidArgumentException

for parameter/option parsing errors

execute()

public execute(Server $server) : CursorInterface
Parameters
$server : Server
Return values
CursorInterface

        
On this page

Search results