0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 17:10:48 +01:00

Merge branch 'master' of git@github.com:mongodb/mongo

This commit is contained in:
Eliot Horowitz 2009-08-24 11:55:06 -04:00
commit 1e7ade52ac
3 changed files with 7 additions and 3 deletions

View File

@ -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 );
}

View File

@ -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)");

View File

@ -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" );