Files
mongo/jstests/core/js2.js

24 lines
534 B
JavaScript
Raw Normal View History

2009-01-26 23:28:26 -05:00
t = db.jstests_js2;
2009-01-26 23:28:26 -05:00
t.remove( {} );
t2 = db.jstests_js2_2;
t2.remove( {} );
2009-01-26 23:28:26 -05:00
assert.eq( 0 , t2.find().length() , "A" );
2009-01-26 23:28:26 -05:00
t.save( { z : 1 } );
t.save( { z : 2 } );
assert.throws( function(){
t.find( { $where :
2009-01-26 23:28:26 -05:00
function(){
db.jstests_js2_2.save( { y : 1 } );
2009-01-26 23:28:26 -05:00
return 1;
}
2011-01-24 00:19:53 -05:00
} ).forEach( printjson );
2011-01-21 07:58:02 -05:00
} , null , "can't save from $where" );
2009-01-26 23:28:26 -05:00
assert.eq( 0 , t2.find().length() , "B" )
2009-01-26 23:28:26 -05:00
assert(t.validate().valid , "E");