diff options
Diffstat (limited to 'jstests/aggregation/bugs/server6184.js')
-rw-r--r-- | jstests/aggregation/bugs/server6184.js | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/jstests/aggregation/bugs/server6184.js b/jstests/aggregation/bugs/server6184.js index fd2e1b397aa..ae0f5ae947c 100644 --- a/jstests/aggregation/bugs/server6184.js +++ b/jstests/aggregation/bugs/server6184.js @@ -3,18 +3,20 @@ c = db.c; c.drop(); -c.save( { a:'missing', b:{ c:'bar', a: 'baz', z:'not there' } } ); +c.save({a: 'missing', b: {c: 'bar', a: 'baz', z: 'not there'}}); function test(projection) { res = c.aggregate({$project: projection}); assert.eq(res.toArray()[0], {b: {c: 'bar', a: 'baz'}}); } -test({_id:0, b: {a:1}, 'b.c': 1}); -test({_id:0, 'b.c': 1, b: {a:1}}); +test({_id: 0, b: {a: 1}, 'b.c': 1}); +test({_id: 0, 'b.c': 1, b: {a: 1}}); // Synthetic fields should be in the order they appear in the $project -one = {$add:[1]}; -res = c.aggregate({$project: {_id:0, 'A.Z':one, A:{Y:one, A:one}, 'A.B': one}}); -assert.eq(res.toArray()[0], {A: {Z:1, Y:1, A:1, B:1}}); +one = { + $add: [1] +}; +res = c.aggregate({$project: {_id: 0, 'A.Z': one, A: {Y: one, A: one}, 'A.B': one}}); +assert.eq(res.toArray()[0], {A: {Z: 1, Y: 1, A: 1, B: 1}}); |