2009-04-30 10:40:33 -04:00
|
|
|
|
2016-03-09 12:17:50 -05:00
|
|
|
assert.eq(17,
|
|
|
|
|
db.eval(function() {
|
|
|
|
|
return 11 + 6;
|
|
|
|
|
}),
|
|
|
|
|
"A");
|
2016-05-28 17:55:12 -04:00
|
|
|
assert.eq(17, db.eval(function(x) {
|
|
|
|
|
return 10 + x;
|
|
|
|
|
}, 7), "B");
|
2011-08-21 16:33:32 -07:00
|
|
|
|
|
|
|
|
// check that functions in system.js work
|
2016-03-09 12:17:50 -05:00
|
|
|
db.system.js.insert({
|
|
|
|
|
_id: "add",
|
|
|
|
|
value: function(x, y) {
|
|
|
|
|
return x + y;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
assert.eq(20, db.eval("this.add(15, 5);"), "C");
|