Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

disintct and eoo fix

  • Loading branch information...
commit be1b3de4ca39acff3db7088a4f50719f0b9d09bb 1 parent 3eb4295
@erh erh authored
Showing with 9 additions and 0 deletions.
  1. +2 −0  db/dbcommands.cpp
  2. +7 −0 jstests/distinct2.js
View
2  db/dbcommands.cpp
@@ -1431,6 +1431,8 @@ namespace mongo {
while ( cursor->more() ){
BSONObj o = cursor->next();
BSONObj value = o.extractFields( keyPattern );
+ if ( value.isEmpty() )
+ continue;
if ( map.insert( value ).second ){
size += o.objsize() + 20;
uassert( "distinct too big, 4mb cap" , size < 4 * 1024 * 1024 );
View
7 jstests/distinct2.js
@@ -4,3 +4,10 @@ t.drop();
t.save({a:null});
assert.eq( 0 , t.distinct('a.b').length , "A" );
+
+t.drop();
+t.save( { a : 1 } );
+assert.eq( [1] , t.distinct( "a" ) , "B" );
+t.save( {} )
+assert.eq( [1] , t.distinct( "a" ) , "C" );
+
Please sign in to comment.
Something went wrong with that request. Please try again.