Skip to content

Commit

Permalink
Remove rw aggregation not supported in a transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
GromNaN committed Jun 26, 2023
1 parent 52340de commit 28cc1f5
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions tests/Collection/CollectionFunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use MongoDB\Collection;
use MongoDB\Database;
use MongoDB\Driver\BulkWrite;
use MongoDB\Driver\Exception\CommandException;
use MongoDB\Driver\ReadConcern;
use MongoDB\Driver\ReadPreference;
use MongoDB\Driver\WriteConcern;
Expand Down Expand Up @@ -457,6 +456,7 @@ function ($collection, $session, $options = []): void {
}, 'r',
],

/* Disabled, as write aggregations are not supported in transactions
'read-write aggregate' => [
function ($collection, $session, $options = []): void {
$collection->aggregate(
Expand All @@ -468,6 +468,7 @@ function ($collection, $session, $options = []): void {
);
}, 'rw',
],
*/

'bulkWrite insertOne' => [
function ($collection, $session, $options = []): void {
Expand Down Expand Up @@ -748,16 +749,7 @@ public function testMethodDoesNotInheritReadWriteConcernInTransaction(Closure $m

(new CommandObserver())->observe(
function () use ($method, $collection, $session): void {
try {
call_user_func($method, $collection, $session);
} catch (CommandException $exception) {
// Write aggregates are not supported in transactions
if ($exception->getResultDocument()->codeName === 'OperationNotSupportedInTransaction') {
$this->markTestSkipped('OperationNotSupportedInTransaction: ' . $exception->getMessage());
}

throw $exception;
}
call_user_func($method, $collection, $session);
},
function (array $event): void {
$this->assertObjectNotHasAttribute('writeConcern', $event['started']->getCommand());
Expand Down

0 comments on commit 28cc1f5

Please sign in to comment.