Skip to content

Commit 8fc6915

Browse files
committed
Apply feedback from code review
1 parent 203160e commit 8fc6915

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/Concerns/ManagesTransactions.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,15 @@
88
use MongoDB\Driver\Session;
99
use function MongoDB\with_transaction;
1010

11+
/**
12+
* @see https://docs.mongodb.com/manual/core/transactions/
13+
*/
1114
trait ManagesTransactions
1215
{
1316
protected ?Session $session = null;
1417

18+
protected $transactions = 0;
19+
1520
/**
1621
* @return Client
1722
*/
@@ -43,12 +48,7 @@ private function getSessionOrThrow(): Session
4348
}
4449

4550
/**
46-
* Use the existing or create new session and start a transaction in session.
47-
*
48-
* In version 4.0, MongoDB supports multi-document transactions on replica sets.
49-
* In version 4.2, MongoDB introduces distributed transactions, which adds support for multi-document transactions on sharded clusters and incorporates the existing support for multi-document transactions on replica sets.
50-
*
51-
* @see https://docs.mongodb.com/manual/core/transactions/
51+
* Starts a transaction on the active session. An active session will be created if none exists.
5252
*/
5353
public function beginTransaction(array $options = []): void
5454
{
@@ -66,7 +66,7 @@ public function commit(): void
6666
}
6767

6868
/**
69-
* Rollback transaction in this session.
69+
* Abort transaction in this session.
7070
*/
7171
public function rollBack($toLevel = null): void
7272
{

src/Query/Builder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ public function from($collection, $as = null)
734734
public function truncate(): bool
735735
{
736736
$options = $this->inheritConnectionOptions();
737-
$result = $this->collection->deleteMany($options);
737+
$result = $this->collection->deleteMany([], $options);
738738

739739
return 1 === (int) $result->isAcknowledged();
740740
}

0 commit comments

Comments
 (0)