diff options
author | Eliot Horowitz <eliot@10gen.com> | 2009-09-29 23:37:13 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2009-09-29 23:37:13 -0400 |
commit | 754655029fad32f63dc76ac836aa126a29de9178 (patch) | |
tree | cd75a2daac81647f3ffdf5cf33eca5b927490923 /jstests/mr1.js | |
parent | c000bcaafd94c46bba57bdad247d7285a2d91507 (diff) | |
download | mongo-754655029fad32f63dc76ac836aa126a29de9178.tar.gz |
optional out paramter for map/reduce
Diffstat (limited to 'jstests/mr1.js')
-rw-r--r-- | jstests/mr1.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/jstests/mr1.js b/jstests/mr1.js index 82a2e8e7cf5..f999b9d3d64 100644 --- a/jstests/mr1.js +++ b/jstests/mr1.js @@ -49,6 +49,17 @@ assert.eq( 1 , z.b , "C2" ); assert.eq( 2 , z.c , "C3" ); x.drop(); +res = db.runCommand( { mapreduce : "mr1" , out : "foo" , map : m , reduce : r , query : { x : { "$gt" : 2 } } } ); +assert.eq( 2 , res.numObjects , "B2" ); +assert.eq( "foo" , res.result , "B2-c" ); +x = db[res.result]; +z = {}; +x.find().forEach( function(a){ z[a.key] = a.value.count; } ); +assert.eq( 1 , z.a , "C1a" ); +assert.eq( 1 , z.b , "C2a" ); +assert.eq( 2 , z.c , "C3a" ); +x.drop(); + for ( i=5; i<1000; i++ ){ |