Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix $all with an empty arraty SERVER-143

  • Loading branch information...
commit e6aee429a9e77798d3e871112bcfaad11a3d7488 1 parent 59255f4
@erh erh authored
Showing with 8 additions and 1 deletion.
  1. +1 −1  db/matcher.cpp
  2. +7 −0 jstests/all.js
View
2  db/matcher.cpp
@@ -319,7 +319,7 @@ namespace mongo {
if ( bm.myset->count( e ) )
matches.insert( e );
}
- if ( bm.myset->size() == matches.size() ) {
+ if ( matches.size() > 0 && bm.myset->size() == matches.size() ) {
if ( deep )
*deep = true;
return true;
View
7 jstests/all.js
@@ -30,6 +30,13 @@ doTest = function() {
t.save( { a: { b: [ 20, 30 ] } } );
assert.eq( 1, t.find( { 'a.b': { $all: [ 20 ] } } ).count() );
assert.eq( 1, t.find( { 'a.b': { $all: [ 20, 30 ] } } ).count() );
+
+
+ assert.eq( 5 , t.find( { a : { $all : [1] } } ).count() , "E1" );
+ assert.eq( 0 , t.find( { a : { $all : [19] } } ).count() , "E2" );
+ assert.eq( 0 , t.find( { a : { $all : [] } } ).count() , "E3" );
+
+
}
doTest();
Please sign in to comment.
Something went wrong with that request. Please try again.