Skip to content

Commit d2feb44

Browse files
committed
Add comment
1 parent 286eebf commit d2feb44

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/Eloquent/Builder.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,8 @@ public function createOrFirst(array $attributes = [], array $values = []): Model
214214
try {
215215
$document = $collection->findOneAndUpdate(
216216
$attributes,
217+
// Before MongoDB 5.0, the $setOnInsert does support empty document,
218+
// so the filter value are added to avoid an error.
217219
['$setOnInsert' => (object) $values],
218220
[
219221
'upsert' => true,

0 commit comments

Comments
 (0)