diff options
Diffstat (limited to 'jstests/aggregation/bugs/server6127.js')
-rw-r--r-- | jstests/aggregation/bugs/server6127.js | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/jstests/aggregation/bugs/server6127.js b/jstests/aggregation/bugs/server6127.js index 26585c87d21..1f11d858c83 100644 --- a/jstests/aggregation/bugs/server6127.js +++ b/jstests/aggregation/bugs/server6127.js @@ -7,21 +7,21 @@ * is no path). Previous it would uassert causing the aggregation to end. */ (function() { - "use strict"; - db.s6127.drop(); +"use strict"; +db.s6127.drop(); - assert.writeOK(db.s6127.insert({_id: 0, a: 1})); - assert.writeOK(db.s6127.insert({_id: 1, foo: 2})); - assert.writeOK(db.s6127.insert({_id: 2, foo: {bar: 3}})); +assert.writeOK(db.s6127.insert({_id: 0, a: 1})); +assert.writeOK(db.s6127.insert({_id: 1, foo: 2})); +assert.writeOK(db.s6127.insert({_id: 2, foo: {bar: 3}})); - // Aggregate checking the field foo and the path foo.bar. - const cursor = db.s6127.aggregate( - [{$sort: {_id: 1}}, {$project: {_id: 0, "foo.bar": 1, field: "$foo", path: "$foo.bar"}}]); +// Aggregate checking the field foo and the path foo.bar. +const cursor = db.s6127.aggregate( + [{$sort: {_id: 1}}, {$project: {_id: 0, "foo.bar": 1, field: "$foo", path: "$foo.bar"}}]); - // The first document should contain nothing as neither field exists, the second document should - // contain only field as it has a value in foo, but foo does not have a field bar so it cannot - // walk that path, the third document should have both the field and path as foo is an object - // which has a field bar. - const expected = [{}, {field: 2}, {foo: {bar: 3}, field: {bar: 3}, path: 3}]; - assert.eq(cursor.toArray(), expected); +// The first document should contain nothing as neither field exists, the second document should +// contain only field as it has a value in foo, but foo does not have a field bar so it cannot +// walk that path, the third document should have both the field and path as foo is an object +// which has a field bar. +const expected = [{}, {field: 2}, {foo: {bar: 3}, field: {bar: 3}, path: 3}]; +assert.eq(cursor.toArray(), expected); }()); |