diff options
author | Eliot Horowitz <eliot@10gen.com> | 2009-12-02 16:56:37 -0500 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2009-12-02 16:56:37 -0500 |
commit | d3ece690eff86181ad61bf2ad06e59c8e6e98c24 (patch) | |
tree | 10d37524e478ab4477d29e608f9361b50f229412 | |
parent | 36e01bf30b876cd274b0dca3d8712e8f320a547d (diff) | |
download | mongo-d3ece690eff86181ad61bf2ad06e59c8e6e98c24.tar.gz |
add optional options param to more methods
-rw-r--r-- | client/dbclient.cpp | 8 | ||||
-rw-r--r-- | client/dbclient.h | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/client/dbclient.cpp b/client/dbclient.cpp index f8d80a4e01c..d8fc4af2d83 100644 --- a/client/dbclient.cpp +++ b/client/dbclient.cpp @@ -109,9 +109,9 @@ namespace mongo { return o.getIntField("ok") == 1; } - inline bool DBClientWithCommands::runCommand(const string &dbname, const BSONObj& cmd, BSONObj &info) { + inline bool DBClientWithCommands::runCommand(const string &dbname, const BSONObj& cmd, BSONObj &info, int options) { string ns = dbname + ".$cmd"; - info = findOne(ns, cmd); + info = findOne(ns, cmd, 0 , options); return isOk(info); } @@ -127,11 +127,11 @@ namespace mongo { return runCommand(dbname, b.done(), *info); } - unsigned long long DBClientWithCommands::count(const string &_ns, const BSONObj& query) { + unsigned long long DBClientWithCommands::count(const string &_ns, const BSONObj& query, int options) { NamespaceString ns(_ns); BSONObj cmd = BSON( "count" << ns.coll << "query" << query ); BSONObj res; - if( !runCommand(ns.db.c_str(), cmd, res) ) + if( !runCommand(ns.db.c_str(), cmd, res, options) ) uasserted(string("count fails:") + res.toString()); return res.getIntField("n"); } diff --git a/client/dbclient.h b/client/dbclient.h index fadaa21b62e..cae9aad6247 100644 --- a/client/dbclient.h +++ b/client/dbclient.h @@ -338,7 +338,7 @@ namespace mongo { set. @return true if the command returned "ok". */ - bool runCommand(const string &dbname, const BSONObj& cmd, BSONObj &info); + bool runCommand(const string &dbname, const BSONObj& cmd, BSONObj &info, int options=0); /** Authorize access to a particular database. Authentication is separate for each database on the server -- you may authenticate for any @@ -353,7 +353,7 @@ namespace mongo { /** count number of objects in collection ns that match the query criteria specified throws UserAssertion if database returns an error */ - unsigned long long count(const string &ns, const BSONObj& query = BSONObj()); + unsigned long long count(const string &ns, const BSONObj& query = BSONObj(), int options=0 ); string createPasswordDigest( const string &username , const string &clearTextPassword ); |