diff options
author | Eliot Horowitz <eliot@10gen.com> | 2009-08-21 15:17:58 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2009-08-21 15:17:58 -0400 |
commit | 33ac3c31c302b8cb04bd54232bb9f9f6565a1ca7 (patch) | |
tree | 5a1aec4b31e20d790f3da8bb7b8640baa7849bd0 | |
parent | e1928bfda516298dc4dfa1b2782458422cbc98c9 (diff) | |
download | mongo-33ac3c31c302b8cb04bd54232bb9f9f6565a1ca7.tar.gz |
fix mod eq 0
-rw-r--r-- | db/matcher.h | 1 | ||||
-rw-r--r-- | jstests/mod1.js | 5 |
2 files changed, 5 insertions, 1 deletions
diff --git a/db/matcher.h b/db/matcher.h index 03b5b335845..9ef15988e59 100644 --- a/db/matcher.h +++ b/db/matcher.h @@ -63,7 +63,6 @@ namespace mongo { modm = o["1"].numberInt(); uassert( "mod can't be 0" , mod ); - uassert( "mod eq can't be 0" , modm ); } } diff --git a/jstests/mod1.js b/jstests/mod1.js index c77b5091e89..91329b7733a 100644 --- a/jstests/mod1.js +++ b/jstests/mod1.js @@ -5,6 +5,7 @@ t.drop(); t.save( { a : 1 } ); t.save( { a : 2 } ); t.save( { a : 11 } ); +t.save( { a : 20 } ); assert.eq( 2 , t.find( "this.a % 10 == 1" ).itcount() , "A" ); assert.eq( 2 , t.find( { a : { $mod : [ 10 , 1 ] } } ).itcount() , "B" ); @@ -14,3 +15,7 @@ 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" ); +assert.eq( 1 , t.find( "this.a % 10 == 0" ).itcount() , "E" ); +assert.eq( 1 , t.find( { a : { $mod : [ 10 , 0 ] } } ).itcount() , "F" ); + + |