Files
mongo/jstests/core/eval3.js
Randolph Tan 5595b94560 SERVER-12127 migrate js tests to jscore suite when not related to writes
Moved test jstest/[a-i].js -> jstests/core/ and made changes to comply with write command api
2014-02-28 16:26:33 -05:00

22 lines
535 B
JavaScript

t = db.eval3;
t.drop();
t.save( { _id : 1 , name : "eliot" } );
assert.eq( 1 , t.count() , "A" );
function z( a , b ){
db.eval3.save( { _id : a , name : b } );
return b;
}
z( 2 , "sara" );
assert.eq( 2 , t.count() , "B" );
assert.eq( "eliot,sara" , t.find().toArray().map( function(z){ return z.name; } ).sort().toString() );
assert.eq( "joe" , db.eval( z , 3 , "joe" ) , "C" );
assert.eq( 3 , t.count() , "D" );
assert.eq( "eliot,joe,sara" , t.find().toArray().map( function(z){ return z.name; } ).sort().toString() );