@@ -1049,12 +1049,14 @@ the following query builder methods:
1049
1049
Upsert Method
1050
1050
^^^^^^^^^^^^^
1051
1051
1052
- The ``upsert()`` query builder method accepts the following parameters:
1052
+ The ``upsert(array $values, array|string $uniqueBy, array|null
1053
+ $update)`` query builder method accepts the following parameters:
1053
1054
1054
- - Array of fields and values that specify documents to update or insert.
1055
- - Array of fields that uniquely identify documents in your first array parameter.
1056
- - Array of fields to update if a matching document exists. If you omit
1057
- this parameter, {+odm-short+} updates all fields.
1055
+ - ``$values``: Array of fields and values that specify documents to update or insert.
1056
+ - ``$uniqueBy``: List of fields that uniquely identify documents in your
1057
+ first array parameter.
1058
+ - ``$update``: Optional list of fields to update if a matching document
1059
+ exists. If you omit this parameter, {+odm-short+} updates all fields.
1058
1060
1059
1061
The following example shows how to use the ``upsert()`` query builder method
1060
1062
to update or insert documents based on the following instructions:
@@ -1081,6 +1083,12 @@ to update or insert documents based on the following instructions:
1081
1083
The ``upsert()`` query builder method returns the number of
1082
1084
documents that the operation updated, inserted, and modified.
1083
1085
1086
+ .. note::
1087
+
1088
+ The ``upsert()`` method does not trigger events. To trigger events
1089
+ from an upsert operation, you can use the ``createOrFirst()`` method
1090
+ instead.
1091
+
1084
1092
Update Method
1085
1093
^^^^^^^^^^^^^
1086
1094
0 commit comments