summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2009-08-21 15:17:58 -0400
committerEliot Horowitz <eliot@10gen.com>2009-08-21 15:17:58 -0400
commit33ac3c31c302b8cb04bd54232bb9f9f6565a1ca7 (patch)
tree5a1aec4b31e20d790f3da8bb7b8640baa7849bd0
parente1928bfda516298dc4dfa1b2782458422cbc98c9 (diff)
downloadmongo-33ac3c31c302b8cb04bd54232bb9f9f6565a1ca7.tar.gz
fix mod eq 0
-rw-r--r--db/matcher.h1
-rw-r--r--jstests/mod1.js5
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" );
+
+