diff options
Diffstat (limited to 'jstests/mod1.js')
-rw-r--r-- | jstests/mod1.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/jstests/mod1.js b/jstests/mod1.js new file mode 100644 index 00000000000..c77b5091e89 --- /dev/null +++ b/jstests/mod1.js @@ -0,0 +1,16 @@ + +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" ); + |