summaryrefslogtreecommitdiff
path: root/jstests/aggregation/bugs/server6779.js
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2012-08-16 20:17:24 -0400
committerMathias Stearn <mathias@10gen.com>2012-08-20 14:15:10 -0400
commit11420d16263d482419b45464b44d63c1ca7e1ee6 (patch)
tree7364825b5f9f0e5b40bd575bf76a30d451a10926 /jstests/aggregation/bugs/server6779.js
parentd388ca17b0413f7d8d7431e4673de7e6b6eaf444 (diff)
downloadmongo-11420d16263d482419b45464b44d63c1ca7e1ee6.tar.gz
SERVER-6779 Correctly serialize ExpressionCoerceToBool
Diffstat (limited to 'jstests/aggregation/bugs/server6779.js')
-rw-r--r--jstests/aggregation/bugs/server6779.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/jstests/aggregation/bugs/server6779.js b/jstests/aggregation/bugs/server6779.js
new file mode 100644
index 00000000000..4545dcaff0a
--- /dev/null
+++ b/jstests/aggregation/bugs/server6779.js
@@ -0,0 +1,18 @@
+// server 6779: serializing ExpressionCoerceToBool
+// This test only fails in debug mode with the bug since that tests round-tripping
+function test(op, val) {
+ t = db.server6779;
+ t.drop();
+
+ t.insert({a:true});
+ t.insert({a:false});
+
+ obj = {};
+ obj[op] = ['$a', val];
+ result = t.aggregate({$project: {_id: 0, bool: obj}});
+
+ assert.commandWorked(result);
+ assert.eq(result.result, [{bool:true}, {bool:false}]);
+}
+test('$and', true);
+test('$or', false);