Commit 0f91e9f3 authored by Katherine Walker's avatar Katherine Walker

Add writeConcern to Delete and Update

parent c6a2df9a
...@@ -127,7 +127,13 @@ class Delete implements Executable, Explainable ...@@ -127,7 +127,13 @@ class Delete implements Executable, Explainable
public function getCommandDocument() public function getCommandDocument()
{ {
return ['delete' => $this->collectionName, 'deletes' => [['q' => $this->filter] + $this->createDeleteOptions()]]; $cmd = ['delete' => $this->collectionName, 'deletes' => [['q' => $this->filter] + $this->createDeleteOptions()]];
if (isset($this->options['writeConcern'])) {
$cmd['writeConcern'] = $this->options['writeConcern'];
}
return $cmd;
} }
/** /**
......
...@@ -17,8 +17,6 @@ ...@@ -17,8 +17,6 @@
namespace MongoDB\Operation; namespace MongoDB\Operation;
use MongoDB\Driver\Server;
/** /**
* Explainable interface for explainable operations (count, distinct, find, * Explainable interface for explainable operations (count, distinct, find,
* findAndModify, delete, and update). * findAndModify, delete, and update).
......
...@@ -183,7 +183,17 @@ class Update implements Executable, Explainable ...@@ -183,7 +183,17 @@ class Update implements Executable, Explainable
public function getCommandDocument() public function getCommandDocument()
{ {
return ['update' => $this->collectionName, 'updates' => [['q' => $this->filter, 'u' => $this->update] + $this->createUpdateOptions()]]; $cmd = ['update' => $this->collectionName, 'updates' => [['q' => $this->filter, 'u' => $this->update] + $this->createUpdateOptions()]];
if (isset($this->options['writeConcern'])) {
$cmd['writeConcern'] = $this->options['writeConcern'];
}
if (isset($this->options['bypassDocumentValidation']) && \MongoDB\server_supports_feature($server, self::$wireVersionForDocumentLevelValidation)) {
$cmd['bypassDocumentValidation'] = $this->options['bypassDocumentValidation'];
}
return $cmd;
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment