Documentation

DatabaseCommand
in package
implements Executable

Operation for executing a database command.

Tags
see
Database::command()

Interfaces, Classes, Traits and Enums

Executable

Table of Contents

$command  : array<string|int, mixed>|Command|object
$databaseName  : string
$options  : array<string|int, mixed>
__construct()  : mixed
Constructs a command.
execute()  : Cursor
Execute the operation.
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

Return values
mixed

execute()

Execute the operation.

public execute(Server $server) : Cursor
Parameters
$server : Server
Tags
see
Executable::execute()
Return values
Cursor

Search results