mirror of
https://github.com/mongodb/mongo.git
synced 2024-11-30 17:10:48 +01:00
mr query SERVER-208
This commit is contained in:
parent
b5b610c8b1
commit
966e13e27f
@ -255,7 +255,9 @@ namespace mongo {
|
||||
_tlmr.reset( mrtl );
|
||||
|
||||
BSONObj q;
|
||||
|
||||
if ( cmdObj["query"].type() == Object )
|
||||
q = cmdObj["query"].embeddedObjectUserCheck();
|
||||
|
||||
auto_ptr<DBClientCursor> cursor = db.query( ns , q );
|
||||
while ( cursor->more() ){
|
||||
BSONObj o = cursor->next();
|
||||
|
@ -37,9 +37,19 @@ assert.eq( 3 , z.keySet().length , "C" );
|
||||
assert.eq( 2 , z.a , "D" );
|
||||
assert.eq( 3 , z.b , "E" );
|
||||
assert.eq( 3 , z.c , "F" );
|
||||
|
||||
x.drop();
|
||||
|
||||
res = db.runCommand( { mapreduce : "mr1" , map : m , reduce : r , query : { x : { "$gt" : 2 } } } );
|
||||
assert.eq( 2 , res.numObjects , "B" );
|
||||
x = db[res.result];
|
||||
z = {};
|
||||
x.find().forEach( function(a){ z[a.key] = a.value.count; } );
|
||||
assert.eq( 1 , z.a , "C1" );
|
||||
assert.eq( 1 , z.b , "C2" );
|
||||
assert.eq( 2 , z.c , "C3" );
|
||||
x.drop();
|
||||
|
||||
|
||||
|
||||
for ( i=5; i<1000; i++ ){
|
||||
t.save( { x : i , tags : [ "b" , "d" ] } );
|
||||
|
Loading…
Reference in New Issue
Block a user