Documentation

Explain
in package

FinalYes

Operation for the explain command.

Tags
see
Collection::explain()
see
https://mongodb.com/docs/manual/reference/command/explain/

Table of Contents

Constants

VERBOSITY_ALL_PLANS  = 'allPlansExecution'
VERBOSITY_EXEC_STATS  = 'executionStats'
VERBOSITY_QUERY  = 'queryPlanner'

Properties

$databaseName  : string
$explainable  : Explainable
$options  : array<string|int, mixed>

Methods

__construct()  : mixed
Constructs an explain command for explainable operations.
execute()  : array<string|int, mixed>|object
Execute the operation.
createCommand()  : Command
Create the explain command.
createOptions()  : array<string|int, mixed>
Create options for executing the command.

Constants

VERBOSITY_ALL_PLANS

public mixed VERBOSITY_ALL_PLANS = 'allPlansExecution'

VERBOSITY_EXEC_STATS

public mixed VERBOSITY_EXEC_STATS = 'executionStats'

VERBOSITY_QUERY

public mixed VERBOSITY_QUERY = 'queryPlanner'

Properties

$databaseName

private string $databaseName

$explainable

private Explainable $explainable

$options

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

Methods

__construct()

Constructs an explain command for explainable operations.

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

Supported options:

  • comment (mixed): BSON value to attach as a comment to this command.

    This is not supported for servers versions < 4.4.

  • readPreference (MongoDB\Driver\ReadPreference): Read preference.

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

  • typeMap (array): Type map for BSON deserialization. This will be used used for the returned command result document.

  • verbosity (string): The mode in which the explain command will be run.

Parameters
$databaseName : string

Database name

$explainable : Explainable

Operation to explain

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

Command options

Tags
throws
InvalidArgumentException

for parameter/option parsing errors

execute()

Execute the operation.

public execute(Server $server) : array<string|int, mixed>|object
Parameters
$server : Server
Tags
throws
UnsupportedException

if the server does not support explaining the operation

throws
RuntimeException

for other driver errors (e.g. connection errors)

Return values
array<string|int, mixed>|object

createCommand()

Create the explain command.

private createCommand() : Command
Return values
Command

        
On this page

Search results