Skip to content

Commit 52b358a

Browse files
committed
DOCS-14006 clarify return data types sum subtract
1 parent fa79e47 commit 52b358a

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

source/reference/operator/aggregation/subtract.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,22 @@ Definition
3333
first argument. For more information on expressions, see
3434
:ref:`aggregation-expressions`.
3535

36+
Behavior
37+
--------
38+
39+
Starting in MongoDB 4.4.3, the result will have the same type as the
40+
input except when it cannot be represented accurately in that type. In
41+
these cases:
42+
43+
- A 32-bit integer will be converted to a 64-bit integer if the
44+
result is representable as a 64-bit integer.
45+
46+
- A 32-bit integer will be converted to a double if the result is
47+
not representable as a 64-bit integer.
48+
49+
- A 64-bit integer will be converted to double if the result is not
50+
representable as a 64-bit integer.
51+
3652
Examples
3753
--------
3854

source/reference/operator/aggregation/sum.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,21 @@ Definition
5252
Behavior
5353
--------
5454

55+
Result Data Type
56+
~~~~~~~~~~~~~~~~
57+
58+
The result will have the same type as the input except when it cannot be
59+
represented accurately in that type. In these cases:
60+
61+
- A 32-bit integer will be converted to a 64-bit integer if the
62+
result is representable as a 64-bit integer.
63+
64+
- A 32-bit integer will be converted to a double if the result is
65+
not representable as a 64-bit integer.
66+
67+
- A 64-bit integer will be converted to double if the result is not
68+
representable as a 64-bit integer.
69+
5570
Non-Numeric or Non-Existent Fields
5671
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5772

0 commit comments

Comments
 (0)