MongoDB\Driver\Manager::executeWriteCommand

(mongodb >=1.4.0)

MongoDB\Driver\Manager::executeWriteCommandExecute a database command that writes

Descrierea

final public MongoDB\Driver\Manager::executeWriteCommand ( string $db , MongoDB\Driver\Command $command [, array $options = array() ] ) : 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) and take the MongoDB server version into account. The "writeConcern" option will default to the corresponding value from the MongoDB Connection URI.

Notă: 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 commands.

Parametri

db (string)

Denumirea bazei de date asupra căreia va fi executată comanda.

command (MongoDB\Driver\Command)

Comanda spre a fi executată.

options

options
Option Type Description
session MongoDB\Driver\Session

O sesiune pentru a fi asociată cu operațiunea.

writeConcern MongoDB\Driver\WriteConcern

O preocupare de înscriere pentru a fi aplicată operațiunii.

Avertizare

Dacă utilizați un "session" care are o tranzacție în desfășurare, nu puteți specifica opțiunile "readConcern" sau "writeConcern". Aceasta va rezulta în emiterea unei excepții MongoDB\Driver\Exception\InvalidArgumentException. În loc, trebuie să stabiliți aceste două opțiuni când creați tranzacția cu MongoDB\Driver\Session::startTransaction().

Valorile întoarse

Întoarce MongoDB\Driver\Cursor în caz de succes.

Erori/Excepții

Istoricul schimbărilor

Versiune Descriere
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.

A se vedea și

add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top