summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2009-08-24 11:59:00 -0400
committerEliot Horowitz <eliot@10gen.com>2009-08-24 11:59:00 -0400
commit1f08223ab7d07606bd980abd0b0a7f50cd99314f (patch)
tree282a0f1619a03c9dca0411e21bc6b34a8036b41d
parent1e7ade52ac1260a7f2cea7356500eb39550d0944 (diff)
downloadmongo-1f08223ab7d07606bd980abd0b0a7f50cd99314f.tar.gz
make shell use group cmd by default (can use groupeval if you want)
fix group where no key specified
-rw-r--r--db/dbcommands.cpp3
-rw-r--r--shell/db.js4
2 files changed, 4 insertions, 3 deletions
diff --git a/db/dbcommands.cpp b/db/dbcommands.cpp
index 18a01d18e68..683d848ef15 100644
--- a/db/dbcommands.cpp
+++ b/db/dbcommands.cpp
@@ -1217,8 +1217,7 @@ namespace mongo {
keyf = p["$keyf"].ascode();
}
else {
- errmsg = "parameter 'key' is missing or not an object";
- return false;
+ // no key specified, will use entire object as key
}
return group( realdbname , cursor , key , keyf , p["$reduce"].ascode() , p["initial"].embeddedObjectUserCheck() , errmsg , result );
diff --git a/shell/db.js b/shell/db.js
index 0aa80cdaf34..43d53cf96f5 100644
--- a/shell/db.js
+++ b/shell/db.js
@@ -367,7 +367,7 @@ DB.prototype.dbEval = DB.prototype.eval;
keyf is a function which takes an object and returns the desired key. set either key or keyf (not both).
* </p>
*/
-DB.prototype.group = function(parmsObj) {
+DB.prototype.groupeval = function(parmsObj) {
var groupFunction = function() {
var parms = args[0];
@@ -412,6 +412,8 @@ DB.prototype.groupcmd = function( parmsObj ){
return ret.retval;
}
+DB.prototype.group = DB.prototype.groupcmd;
+
DB.prototype._groupFixParms = function( parmsObj ){
var parms = Object.extend({}, parmsObj);