Skip to content

Commit f52c1e9

Browse files
Merge remote-tracking branch 'upstream/feat-mongo-tmp' into attributes-fix-schemaless
2 parents 84cbadf + 7c84b39 commit f52c1e9

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

composer.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Database/Adapter/Mongo.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,9 @@ public function withTransaction(callable $callback): mixed
126126

127127
public function startTransaction(): bool
128128
{
129-
130129
// If the database is not a replica set, we can't use transactions
131130
if (!$this->client->isReplicaSet()) {
132-
return false;
131+
return true;
133132
}
134133

135134
try {
@@ -163,6 +162,11 @@ public function startTransaction(): bool
163162

164163
public function commitTransaction(): bool
165164
{
165+
// If the database is not a replica set, we can't use transactions
166+
if (!$this->client->isReplicaSet()) {
167+
return true;
168+
}
169+
166170
try {
167171
if ($this->inTransaction === 0) {
168172
return false;
@@ -195,6 +199,11 @@ public function commitTransaction(): bool
195199

196200
public function rollbackTransaction(): bool
197201
{
202+
// If the database is not a replica set, we can't use transactions
203+
if (!$this->client->isReplicaSet()) {
204+
return true;
205+
}
206+
198207
try {
199208
if ($this->inTransaction === 0) {
200209
return false;

0 commit comments

Comments
 (0)