From 33ac3c31c302b8cb04bd54232bb9f9f6565a1ca7 Mon Sep 17 00:00:00 2001 From: Eliot Horowitz Date: Fri, 21 Aug 2009 15:17:58 -0400 Subject: fix mod eq 0 --- db/matcher.h | 1 - jstests/mod1.js | 5 +++++ 2 files changed, 5 insertions(+), 1 deletion(-) 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" ); + + -- cgit v1.2.1