diff options
Diffstat (limited to 'jstests/aggregation/bugs/server9841.js')
-rw-r--r-- | jstests/aggregation/bugs/server9841.js | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/jstests/aggregation/bugs/server9841.js b/jstests/aggregation/bugs/server9841.js index 5bf9b32db93..28e6037caf1 100644 --- a/jstests/aggregation/bugs/server9841.js +++ b/jstests/aggregation/bugs/server9841.js @@ -16,27 +16,26 @@ function test(expression, expected) { assert.eq(result, [{res: expected}]); } -test({$map: {input: "$simple", as: "var", in: '$$var'}}, [1, 2, 3, 4]); -test({$map: {input: "$simple", as: "var", in: {$add: [10, '$$var']}}}, [11, 12, 13, 14]); +test({$map: {input: "$simple", as: "var", in : '$$var'}}, [1, 2, 3, 4]); +test({$map: {input: "$simple", as: "var", in : {$add: [10, '$$var']}}}, [11, 12, 13, 14]); -test({$map: {input: "$nested", as: "var", in: '$$var.a'}}, [1, 2]); -test({$map: {input: "$nested", as: "CURRENT", in: '$a'}}, [1, 2]); +test({$map: {input: "$nested", as: "var", in : '$$var.a'}}, [1, 2]); +test({$map: {input: "$nested", as: "CURRENT", in : '$a'}}, [1, 2]); -test({$map: {input: "$mixed", as: "var", in: '$$var.a'}}, +test({$map: {input: "$mixed", as: "var", in : '$$var.a'}}, [1, null, 2, null]); // missing becomes null -test({$map: {input: "$null", as: "var", in: '$$var'}}, null); +test({$map: {input: "$null", as: "var", in : '$$var'}}, null); // can't set ROOT -assertErrorCode(t, {$project: {a: {$map: {input: "$simple", as: "ROOT", in: '$$ROOT'}}}}, 16867); +assertErrorCode(t, {$project: {a: {$map: {input: "$simple", as: "ROOT", in : '$$ROOT'}}}}, 16867); // error on non-array -assertErrorCode(t, {$project: {a: {$map: {input: "$notArray", as: "var", in: '$$var'}}}}, 16883); +assertErrorCode(t, {$project: {a: {$map: {input: "$notArray", as: "var", in : '$$var'}}}}, 16883); // parse errors (missing or extra fields) -assertErrorCode(t, - {$project: {a: {$map: {x: 1, input: "$simple", as: "var", in: '$$var'}}}}, - 16879); -assertErrorCode(t, {$project: {a: {$map: {as: "var", in: '$$var'}}}}, 16880); -assertErrorCode(t, {$project: {a: {$map: {input: "$simple", in: '$$var'}}}}, 16881); +assertErrorCode( + t, {$project: {a: {$map: {x: 1, input: "$simple", as: "var", in : '$$var'}}}}, 16879); +assertErrorCode(t, {$project: {a: {$map: {as: "var", in : '$$var'}}}}, 16880); +assertErrorCode(t, {$project: {a: {$map: {input: "$simple", in : '$$var'}}}}, 16881); assertErrorCode(t, {$project: {a: {$map: {input: "$simple", as: "var"}}}}, 16882); |