0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00
mongodb/jstests/mod1.js
2009-08-20 16:50:58 -04:00

17 lines
395 B
JavaScript

t = db.mod1;
t.drop();
t.save( { a : 1 } );
t.save( { a : 2 } );
t.save( { a : 11 } );
assert.eq( 2 , t.find( "this.a % 10 == 1" ).itcount() , "A" );
assert.eq( 2 , t.find( { a : { $mod : [ 10 , 1 ] } } ).itcount() , "B" );
t.ensureIndex( { a : 1 } );
assert.eq( 2 , t.find( "this.a % 10 == 1" ).itcount() , "C" );
assert.eq( 2 , t.find( { a : { $mod : [ 10 , 1 ] } } ).itcount() , "D" );