summaryrefslogtreecommitdiff
path: root/db/mr.cpp
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2009-11-10 15:43:51 -0500
committerEliot Horowitz <eliot@10gen.com>2009-11-10 15:43:51 -0500
commit123cd0eb6734f397ebf4236e0779d056243446d4 (patch)
treef216d0563330f23445dcd522c6620ada1c7a91b8 /db/mr.cpp
parentc47308b1b4c677d782b6f4ed516894bc5210774e (diff)
downloadmongo-123cd0eb6734f397ebf4236e0779d056243446d4.tar.gz
optional params for map function SERVER-401
Diffstat (limited to 'db/mr.cpp')
-rw-r--r--db/mr.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/db/mr.cpp b/db/mr.cpp
index 79042b23d41..521ef79fcd2 100644
--- a/db/mr.cpp
+++ b/db/mr.cpp
@@ -124,6 +124,13 @@ namespace mongo {
finalizeCode = cmdObj["finalize"].ascode();
}
+
+ if ( cmdObj["mapparams"].type() == Array ){
+ mapparams = cmdObj["mapparams"].embeddedObjectUserCheck();
+ }
+ else {
+ mapparams = BSONObj();
+ }
}
{ // query options
@@ -174,6 +181,8 @@ namespace mongo {
string mapCode;
string reduceCode;
string finalizeCode;
+
+ BSONObj mapparams;
// output tables
string incLong;
@@ -375,7 +384,7 @@ namespace mongo {
if ( mr.verbose ) mt.reset();
state.scope->setThis( &o );
- if ( state.scope->invoke( state.map , BSONObj() , 0 , true ) )
+ if ( state.scope->invoke( state.map , state.setup.mapparams , 0 , true ) )
throw UserException( (string)"map invoke failed: " + state.scope->getError() );
if ( mr.verbose ) mapTime += mt.micros();