summaryrefslogtreecommitdiff
path: root/db/dbcommands.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'db/dbcommands.cpp')
-rw-r--r--db/dbcommands.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/db/dbcommands.cpp b/db/dbcommands.cpp
index f7e39afc2d4..57bc170d0f8 100644
--- a/db/dbcommands.cpp
+++ b/db/dbcommands.cpp
@@ -1111,7 +1111,7 @@ namespace mongo {
GroupCommand() : Command("group"){}
virtual bool slaveOk() { return true; }
virtual void help( stringstream &help ) const {
- help << "example: TODO";
+ help << "see http://www.mongodb.org/display/DOCS/Aggregation";
}
BSONObj getKey( const BSONObj& obj , const BSONObj& keyPattern , const string keyFunction , double avgSize ){
@@ -1182,6 +1182,7 @@ namespace mongo {
bool run(const char *dbname, BSONObj& jsobj, string& errmsg, BSONObjBuilder& result, bool fromRepl ){
static DBDirectClient db;
+ /* db.$cmd.findOne( { group : <p> } ) */
const BSONObj& p = jsobj.firstElement().embeddedObjectUserCheck();
BSONObj q;
@@ -1213,7 +1214,10 @@ namespace mongo {
else if ( p["$keyf"].type() ){
keyf = p["$keyf"].ascode();
}
-
+ else {
+ errmsg = "parameter 'key' is missing or not an object";
+ return false;
+ }
return group( realdbname , cursor , key , keyf , p["$reduce"].ascode() , p["initial"].embeddedObjectUserCheck() , errmsg , result );
}