summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--db/dbcommands.cpp8
-rw-r--r--shell/collection.js1
-rw-r--r--shell/db.js1
3 files changed, 7 insertions, 3 deletions
diff --git a/db/dbcommands.cpp b/db/dbcommands.cpp
index 0c6cb0dbc34..18a01d18e68 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 ){
@@ -1184,6 +1184,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;
@@ -1215,7 +1216,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 );
}
diff --git a/shell/collection.js b/shell/collection.js
index e2103e4abc5..32fbc519acf 100644
--- a/shell/collection.js
+++ b/shell/collection.js
@@ -36,6 +36,7 @@ DBCollection.prototype.help = function(){
print("\tdb.foo.find(...).skip(n)");
print("\tdb.foo.find(...).count()");
print("\tdb.foo.count()");
+ print("\tdb.foo.group( { key : ..., initial: ..., reduce : ...[, cond: ...] } )");
print("\tdb.foo.save(obj)");
print("\tdb.foo.update(query, object[, upsert_bool])");
print("\tdb.foo.ensureIndex(keypattern)");
diff --git a/shell/db.js b/shell/db.js
index 7cd7effddc9..0aa80cdaf34 100644
--- a/shell/db.js
+++ b/shell/db.js
@@ -261,7 +261,6 @@ DB.prototype.help = function() {
print("\tdb.getPrevError()");
print("\tdb.resetError()");
print("\tdb.getCollectionNames()");
- print("\tdb.group(ns, key[, keyf], cond, reduce, initial)");
print("\tdb.currentOp() displays the current operation in the db" );
print("\tdb.killOp() kills the current operation in the db" );
print("\tdb.version() current version of the server" );