summaryrefslogtreecommitdiff
path: root/jstests/core/const_folding_failure.js
blob: 172eddbafd43aa725ca2b707371538dc443494a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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);
})();