0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 17:10:48 +01:00

disintct and eoo fix

This commit is contained in:
Eliot Horowitz 2009-10-27 12:56:59 -04:00
parent 3eb4295ae9
commit be1b3de4ca
2 changed files with 9 additions and 0 deletions

View File

@ -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 File

@ -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" );