summaryrefslogtreecommitdiff
path: root/jstests/core/const_folding_failure.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/core/const_folding_failure.js')
-rw-r--r--jstests/core/const_folding_failure.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/jstests/core/const_folding_failure.js b/jstests/core/const_folding_failure.js
new file mode 100644
index 00000000000..172eddbafd4
--- /dev/null
+++ b/jstests/core/const_folding_failure.js
@@ -0,0 +1,29 @@
+// Tests that checks if optimization errors raised with a specific code
+// @tags: [
+// requires_fcv_51
+// ]
+
+(function() {
+"use strict";
+
+const coll = db.getCollection(jsTestName());
+
+coll.drop();
+
+// Forcing optimizer only failure (empty collection, $project will never execute)
+assert.throwsWithCode(() => db.nonexistent.aggregate([
+ {$project:
+ {dt1:
+ {$map:
+ {
+ input: "$a",
+ as: "b",
+ in: {
+ $toDate: {
+ $dayOfYear: {
+ date: new Date("2019-04-08T11:48:29.394Z"),
+ timezone: "Australia/Melbourne"
+ }
+ }
+ }}}}}]), 5693200);
+})();