diff --git a/source/reference/operator/query/mod.txt b/source/reference/operator/query/mod.txt index 147fcbdd54c..0855b6c3cfb 100644 --- a/source/reference/operator/query/mod.txt +++ b/source/reference/operator/query/mod.txt @@ -21,20 +21,22 @@ $mod { field: { $mod: [ divisor, remainder ] } } +.. _mod-behavior: + Behavior -------- -The :query:`$mod` operator returns an error if the: - -- ``[ divisor, remainder ]`` array contains fewer or more than - two elements. For examples, see :ref:`mod-not-enough-elements` and - :ref:`mod-too-many-elements` respectively. +The :query:`$mod` operator returns an error if the ``[ divisor, +remainder ]`` array contains fewer or more than two elements. For +examples, see :ref:`mod-not-enough-elements` and +:ref:`mod-too-many-elements` respectively. -- ``divisor`` or ``remainder`` values evaluate to: +Also, starting in MongoDB 5.1 (and 5.0.4 and 4.4.10), :query:`$mod` +returns an error if the ``divisor`` or ``remainder`` values evaluate to: - - ``NaN`` (not a number) or ``Infinity``. +- ``NaN`` (not a number) or ``Infinity``. - - A value that cannot be represented using a 64-bit integer. +- A value that cannot be represented using a 64-bit integer. Examples -------- diff --git a/source/release-notes/5.1-compatibility.txt b/source/release-notes/5.1-compatibility.txt index f06bb4dd442..c3ce44fdd2f 100644 --- a/source/release-notes/5.1-compatibility.txt +++ b/source/release-notes/5.1-compatibility.txt @@ -68,6 +68,13 @@ Auditing General Changes --------------- +``$mod`` Error Behavior +~~~~~~~~~~~~~~~~~~~~~~~ + +Starting in MongoDB 5.1 (and 5.0.4 and 4.4.10), the :query:`$mod` +operator returns an error if the ``divisor`` or ``remainder`` values +evaluate to certain values. See :ref:`$mod behavior `. + Deprecations ------------