@@ -1125,6 +1125,23 @@ the ``imdb.votes`` field in the matched document:
11251125The ``increment()`` query builder method returns the number of documents that the
11261126operation updated.
11271127
1128+ Starting in {+odm-short+} v4.8, you can also use the ``incrementEach()`` query
1129+ builder method to increment multiple values in a single operation. The following
1130+ example uses the ``incrementEach()`` method to increase the values of the ``awards.wins``
1131+ and ``imdb.votes`` fields in the matched document:
1132+
1133+ .. literalinclude:: /includes/query-builder/QueryBuilderTest.php
1134+ :language: php
1135+ :dedent:
1136+ :start-after: begin increment each
1137+ :end-before: end increment each
1138+
1139+ .. note::
1140+
1141+ If you pass a field to the ``increment()`` or ``incrementEach()`` method that
1142+ has no value or doesn't exist in the matched documents, these methods initialize
1143+ the specified field to the increment value.
1144+
11281145.. _laravel-mongodb-query-builder-decrement:
11291146
11301147Decrement a Numerical Value Example
@@ -1143,6 +1160,23 @@ matched document:
11431160The ``decrement()`` query builder method returns the number of documents that the
11441161operation updated.
11451162
1163+ Starting in {+odm-short+} v4.8, you can also use the ``decrementEach()`` query builder
1164+ method to decrement multiple values in a single operation. The following example uses
1165+ the ``decrementEach()`` method to decrease the values of the ``metacritic`` and ``imdb.rating``
1166+ fields in the matched document:
1167+
1168+ .. literalinclude:: /includes/query-builder/QueryBuilderTest.php
1169+ :language: php
1170+ :dedent:
1171+ :start-after: begin decrement each
1172+ :end-before: end decrement each
1173+
1174+ .. note::
1175+
1176+ If you pass a field to the ``decrement()`` or ``decrementEach()`` method that
1177+ has no value or doesn't exist in the matched documents, these methods initialize
1178+ the specified field to the decrement value.
1179+
11461180.. _laravel-mongodb-query-builder-push:
11471181
11481182Add an Array Element Example
0 commit comments