MongoDB\Driver\Manager::executeWriteCommand

(mongodb >=1.4.0)

MongoDB\Driver\Manager::executeWriteCommand — Execute a database command that writes

Descrizione

final public function MongoDB\Driver\Manager::executeWriteCommand(string $db, MongoDB\Driver\Command $command, ?array $options = null): MongoDB\Driver\Cursor

Executes the command on the primary server.

This method will apply logic that is specific to commands that write (e.g. » drop). The default value for the "writeConcern" option will be inferred from an active transaction (indicated by the "session" option), followed by the connection URI.

Nota:

This method is not intended to be used to execute » insert, » update, or » delete commands. Users are encouraged to use MongoDB\Driver\Manager::executeBulkWrite() for those operations.

Elenco dei parametri

db (string)

Il nome del database su cui eseguire il comando.

command (MongoDB\Driver\Command)

Il comando da eseguire.

options

options
Option Type Description
session MongoDB\Driver\Session Una sessione da associare all'operazione.
writeConcern MongoDB\Driver\WriteConcern Un write concern da applicare all'operazione.

Avviso

Se si usa una "session" che ha una transazione in corso, non è possibile specificare un'opzione "readConcern" o "writeConcern". Ciò causerà il lancio di un'eccezione MongoDB\Driver\Exception\InvalidArgumentException. Queste due opzioni devono invece essere impostate quando si crea la transazione con MongoDB\Driver\Session::startTransaction().

Valori restituiti

Restituisce un MongoDB\Driver\Cursor in caso di successo.

Errori/Eccezioni

Log delle modifiche

Versione Descrizione
PECL mongodb 1.4.4 MongoDB\Driver\Exception\InvalidArgumentException will be thrown if the "session" option is used in combination with an unacknowledged write concern.

Vedere anche:

User Contributed Notes

There are no user contributed notes for this page.
Adding new notes is disabled. Please see the links in the Found A Problem? section.
To Top