(mongodb >=1.4.0)
MongoDB\Driver\Manager::executeWriteCommand — Execute a database command that writes
$db, MongoDB\Driver\Command $command, ?array $options = null): MongoDB\Driver\CursorExecutes 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.
db (string)Il nome del database su cui eseguire il comando.
command (MongoDB\Driver\Command)Il comando da eseguire.
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. |
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().
Restituisce un MongoDB\Driver\Cursor in caso di successo.
"session" è usata con una transazione associata in combinazione con un'opzione "readConcern" o "writeConcern"."session" è usata in combinazione con un write concern senza conferma (unacknowledged).| 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.
|