2009-01-26 23:28:26 -05:00
|
|
|
|
2011-12-30 10:06:43 -08:00
|
|
|
t = db.jstests_js2;
|
2009-01-26 23:28:26 -05:00
|
|
|
t.remove( {} );
|
|
|
|
|
|
2011-12-30 10:06:43 -08:00
|
|
|
t2 = db.jstests_js2_2;
|
|
|
|
|
t2.remove( {} );
|
2009-01-26 23:28:26 -05:00
|
|
|
|
2011-12-30 10:06:43 -08:00
|
|
|
assert.eq( 0 , t2.find().length() , "A" );
|
2009-01-26 23:28:26 -05:00
|
|
|
|
|
|
|
|
t.save( { z : 1 } );
|
|
|
|
|
t.save( { z : 2 } );
|
2009-12-03 17:41:45 -05:00
|
|
|
assert.throws( function(){
|
|
|
|
|
t.find( { $where :
|
2009-01-26 23:28:26 -05:00
|
|
|
function(){
|
2011-12-30 10:06:43 -08:00
|
|
|
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
|
|
|
|
2011-12-30 10:06:43 -08:00
|
|
|
assert.eq( 0 , t2.find().length() , "B" )
|
2009-01-26 23:28:26 -05:00
|
|
|
|
2009-12-03 17:41:45 -05:00
|
|
|
assert(t.validate().valid , "E");
|