summaryrefslogtreecommitdiff
path: root/jstests/aggregation/expressions/date_add_subtract.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/aggregation/expressions/date_add_subtract.js')
-rw-r--r--jstests/aggregation/expressions/date_add_subtract.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/jstests/aggregation/expressions/date_add_subtract.js b/jstests/aggregation/expressions/date_add_subtract.js
index 57490d19622..8079e64ae83 100644
--- a/jstests/aggregation/expressions/date_add_subtract.js
+++ b/jstests/aggregation/expressions/date_add_subtract.js
@@ -204,9 +204,13 @@ function runAndAssertErrorCode(dateArithmeticsSpec, expectedErrorCode) {
runAndAssertErrorCode({$dateSubtract: {startDate: "$date", unit: "year", amount: 1.001}},
5166405);
- // Overflow error of dateAdd operation due to high amount.
- runAndAssertErrorCode({$dateSubtract: {startDate: "$date", unit: "month", amount: 30000000000}},
- 5166406);
+ // Overflow error of dateAdd operation due to large amount.
+ runAndAssertErrorCode(
+ {$dateSubtract: {startDate: "$date", unit: "month", amount: 12 * 300000000}}, 5166406);
+
+ // Invalid 'amount' parameter error of dateAdd operation due to large amount.
+ runAndAssertErrorCode(
+ {$dateSubtract: {startDate: "$date", unit: "month", amount: -30000000000}}, 5976500);
// Invalid value of timezone argument.
runAndAssertErrorCode(