Skip to content

DOCS-14006 clarify return data types sum subtract #5314

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions source/reference/operator/aggregation/subtract.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,22 @@ Definition
first argument. For more information on expressions, see
:ref:`aggregation-expressions`.

Behavior
--------

Starting in MongoDB 4.0.22, the result will have the same type as the
input except when it cannot be represented accurately in that type. In
these cases:

- A 32-bit integer will be converted to a 64-bit integer if the
result is representable as a 64-bit integer.

- A 32-bit integer will be converted to a double if the result is
not representable as a 64-bit integer.

- A 64-bit integer will be converted to double if the result is not
representable as a 64-bit integer.

Examples
--------

Expand Down
15 changes: 15 additions & 0 deletions source/reference/operator/aggregation/sum.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,21 @@ Definition
Behavior
--------

Result Data Type
~~~~~~~~~~~~~~~~

The result will have the same type as the input except when it cannot be
represented accurately in that type. In these cases:

- A 32-bit integer will be converted to a 64-bit integer if the
result is representable as a 64-bit integer.

- A 32-bit integer will be converted to a double if the result is
not representable as a 64-bit integer.

- A 64-bit integer will be converted to double if the result is not
representable as a 64-bit integer.

Non-Numeric or Non-Existent Fields
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down