diff options
Diffstat (limited to 'jstests/aggregation/bugs/server6147.js')
-rw-r--r-- | jstests/aggregation/bugs/server6147.js | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/jstests/aggregation/bugs/server6147.js b/jstests/aggregation/bugs/server6147.js index 0969b366636..c74e1848512 100644 --- a/jstests/aggregation/bugs/server6147.js +++ b/jstests/aggregation/bugs/server6147.js @@ -6,44 +6,44 @@ * constant and a field regardless of whether they were equal or not. */ (function() { - "use strict"; - db.s6147.drop(); +"use strict"; +db.s6147.drop(); - assert.writeOK(db.s6147.insert({a: 1})); - assert.writeOK(db.s6147.insert({a: 2})); +assert.writeOK(db.s6147.insert({a: 1})); +assert.writeOK(db.s6147.insert({a: 2})); - // Aggregate checking various combinations of the constant and the field. - const cursor = db.s6147.aggregate([ - {$sort: {a: 1}}, - { - $project: { - _id: 0, - constantAndField: {$ne: [1, "$a"]}, - fieldAndConstant: {$ne: ["$a", 1]}, - constantAndConstant: {$ne: [1, 1]}, - fieldAndField: {$ne: ["$a", "$a"]} - } +// Aggregate checking various combinations of the constant and the field. +const cursor = db.s6147.aggregate([ + {$sort: {a: 1}}, + { + $project: { + _id: 0, + constantAndField: {$ne: [1, "$a"]}, + fieldAndConstant: {$ne: ["$a", 1]}, + constantAndConstant: {$ne: [1, 1]}, + fieldAndField: {$ne: ["$a", "$a"]} } - ]); + } +]); - // In both documents, the constantAndConstant and fieldAndField should be false since they - // compare something with itself. However, the constantAndField and fieldAndConstant should be - // different as document one contains 1 which should return false and document 2 contains - // something different so should return true. - const expected = [ - { - constantAndField: false, - fieldAndConstant: false, - constantAndConstant: false, - fieldAndField: false - }, - { - constantAndField: true, - fieldAndConstant: true, - constantAndConstant: false, - fieldAndField: false - } - ]; +// In both documents, the constantAndConstant and fieldAndField should be false since they +// compare something with itself. However, the constantAndField and fieldAndConstant should be +// different as document one contains 1 which should return false and document 2 contains +// something different so should return true. +const expected = [ + { + constantAndField: false, + fieldAndConstant: false, + constantAndConstant: false, + fieldAndField: false + }, + { + constantAndField: true, + fieldAndConstant: true, + constantAndConstant: false, + fieldAndField: false + } +]; - assert.eq(cursor.toArray(), expected); +assert.eq(cursor.toArray(), expected); }()); |