summaryrefslogtreecommitdiff
path: root/db/dbcommands.cpp
diff options
context:
space:
mode:
authorMathias Stearn <redbeard0531@gmail.com>2009-09-17 13:03:30 +0800
committerEliot <eliot@10gen.com>2009-09-17 23:01:12 +0800
commite5a3d001a692a39b107013c8dd4fb91c762a99f7 (patch)
tree4f11918170ecf4cb21be9b386487711ee118c0ba /db/dbcommands.cpp
parent4a8c39140ba731efb5ca0bdb0c3521627b9f2469 (diff)
downloadmongo-e5a3d001a692a39b107013c8dd4fb91c762a99f7.tar.gz
Reflow internal js function MINOR
Signed-off-by: Eliot <eliot@10gen.com>
Diffstat (limited to 'db/dbcommands.cpp')
-rw-r--r--db/dbcommands.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/db/dbcommands.cpp b/db/dbcommands.cpp
index 153dfba8a48..8e21990e20e 100644
--- a/db/dbcommands.cpp
+++ b/db/dbcommands.cpp
@@ -1216,11 +1216,18 @@ namespace mongo {
s->exec( "$reduce = " + reduceCode , "reduce setup" , false , true , true , 100 );
s->exec( "$arr = [];" , "reduce setup 2" , false , true , true , 100 );
- ScriptingFunction f = s->createFunction( "function(){ "
- " if ( $arr[n] == null ){ next = {}; Object.extend( next , $key ); Object.extend( next , $initial ); $arr[n] = next; next = null; }"
- " $reduce( obj , $arr[n] ); "
- "}" );
-
+ ScriptingFunction f = s->createFunction(
+ "function(){ "
+ " if ( $arr[n] == null ){ "
+ " next = {}; "
+ " Object.extend( next , $key ); "
+ " Object.extend( next , $initial ); "
+ " $arr[n] = next; "
+ " next = null; "
+ " } "
+ " $reduce( obj , $arr[n] ); "
+ "}" );
+
ScriptingFunction keyFunction = 0;
if ( keyFunctionCode.size() ){
keyFunction = s->createFunction( keyFunctionCode.c_str() );