Skip to content

Commit 1297fed

Browse files
jason-price-mongodbjason-price-mongodb
andcommitted
DOCS-14662 mod match expression values (mongodb#6022)
DOCS-14662 mod match expression values Co-authored-by: jason-price-mongodb <jshfjghsdfgjsdjh@aolsdjfhkjsdhfkjsdf.com>
1 parent 9036c9a commit 1297fed

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

source/reference/operator/query/mod.txt

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,22 @@ $mod
2121

2222
{ field: { $mod: [ divisor, remainder ] } }
2323

24+
.. _mod-behavior:
25+
2426
Behavior
2527
--------
2628

27-
The :query:`$mod` operator returns an error if the:
28-
29-
- ``[ divisor, remainder ]`` array contains fewer or more than
30-
two elements. For examples, see :ref:`mod-not-enough-elements` and
31-
:ref:`mod-too-many-elements` respectively.
29+
The :query:`$mod` operator returns an error if the ``[ divisor,
30+
remainder ]`` array contains fewer or more than two elements. For
31+
examples, see :ref:`mod-not-enough-elements` and
32+
:ref:`mod-too-many-elements` respectively.
3233

33-
- ``divisor`` or ``remainder`` values evaluate to:
34+
Also, starting in MongoDB 5.1 (and 5.0.4 and 4.4.10), :query:`$mod`
35+
returns an error if the ``divisor`` or ``remainder`` values evaluate to:
3436

35-
- ``NaN`` (not a number) or ``Infinity``.
37+
- ``NaN`` (not a number) or ``Infinity``.
3638

37-
- A value that cannot be represented using a 64-bit integer.
39+
- A value that cannot be represented using a 64-bit integer.
3840

3941
Examples
4042
--------

source/release-notes/5.0-compatibility.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,13 @@ Starting in MongoDB 5.0:
386386
``Double()`` constructor with the :dbcommand:`replSetResizeOplog`
387387
command.
388388

389+
``$mod`` Error Behavior
390+
~~~~~~~~~~~~~~~~~~~~~~~
391+
392+
Starting in MongoDB 5.0.4 (and 4.4.10), the :query:`$mod`
393+
operator returns an error if the ``divisor`` or ``remainder`` values
394+
evaluate to certain values. See :ref:`$mod behavior <mod-behavior>`.
395+
389396
Deprecations
390397
~~~~~~~~~~~~
391398

0 commit comments

Comments
 (0)