Since: 1.3.0

class CommandSucceededEvent (View source)

Encapsulates information about a successful command.

Methods

__wakeup()

No description

string
getCommandName()

Returns the command name.

int
getDurationMicros()

Returns the command's duration in microseconds The command's duration is a calculated value that includes the time to send the message and receive the reply from the server.

string
getHost()

Returns the server hostname for the command

string
getOperationId()

Returns the command's operation ID.

int
getPort()

Returns the server port for the command

object
getReply()

Returns the command reply document.

string
getRequestId()

Returns the command's request ID.

getServer() deprecated

Returns the Server on which the command was executed.

ObjectId|null
getServiceId()

Returns the load balancer service ID for the command

int|null
getServerConnectionId()

Returns the server connection ID for the command

Details

final __wakeup()

No description

final string getCommandName()

Since: 1.3.0

Returns the command name.

Return Value

string

The command name (e.g. "find", "aggregate").

Exceptions

InvalidArgumentException

final int getDurationMicros()

Since: 1.3.0

Returns the command's duration in microseconds The command's duration is a calculated value that includes the time to send the message and receive the reply from the server.

Return Value

int

the command's duration in microseconds.

Exceptions

InvalidArgumentException

final string getHost()

Since: 1.20.0

Returns the server hostname for the command

Return Value

string

Exceptions

InvalidArgumentException

final string getOperationId()

Since: 1.3.0

Returns the command's operation ID.

The operation ID is generated by the driver and may be used to link events together such as bulk write operations, which may have been split across several commands at the protocol level. Note: Since multiple commands may share the same operation ID, it is not reliable to use this value to associate event objects with each other. The request ID returned by MongoDB\Driver\Monitoring\CommandSucceededEvent::getRequestId() should be used instead.

Return Value

string

the command's operation ID.

Exceptions

InvalidArgumentException

final int getPort()

Since: 1.20.0

Returns the server port for the command

Return Value

int

Exceptions

InvalidArgumentException

final object getReply()

Since: 1.3.0

Returns the command reply document.

The reply document will be converted from BSON to PHP using the default deserialization rules (e.g. BSON documents will be converted to stdClass).

Return Value

object

the command reply document as a stdClass object.

Exceptions

InvalidArgumentException

final string getRequestId()

Since: 1.3.0

Returns the command's request ID.

The request ID is generated by the driver and may be used to associate this CommandSucceededEvent with a previous CommandStartedEvent.

Return Value

string

the command's request ID.

Exceptions

InvalidArgumentException

final Server getServer() deprecated

Since: 1.3.0

deprecated Use getHost and getPort instead.

Returns the Server on which the command was executed.

Return Value

Server

on which the command was executed.

final ObjectId|null getServiceId()

Since: 1.11.0

Returns the load balancer service ID for the command

Return Value

ObjectId|null

final int|null getServerConnectionId()

Since: 1.14.0

Returns the server connection ID for the command

Return Value

int|null