diff options
author | Dwight <dmerriman@gmail.com> | 2008-04-29 15:34:11 -0400 |
---|---|---|
committer | Dwight <dmerriman@gmail.com> | 2008-04-29 15:34:11 -0400 |
commit | 9b01407c9fd32d3c208346857499e745b2f5c6e8 (patch) | |
tree | 38968f6b88c9911ee2f7446334c7c4d8782e2e20 | |
parent | a8339eedf68b1a7b483840c2c8236aea98970347 (diff) | |
download | mongo-9b01407c9fd32d3c208346857499e745b2f5c6e8.tar.gz |
get profiling level
-rw-r--r-- | db/query.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/db/query.cpp b/db/query.cpp index 45465da3675..109257408f6 100644 --- a/db/query.cpp +++ b/db/query.cpp @@ -470,8 +470,17 @@ inline bool _runCommands(const char *ns, JSObj& jsobj, stringstream& ss, BufBuil else if( e.type() == Number ) {
if( strcmp(e.fieldName(), "profile") == 0 ) {
anObjBuilderForYa.append("was", (double) client->profile);
- client->profile = (int) e.number();
- valid = ok = true;
+ int p = (int) e.number();
+ valid = true;
+ if( p == -1 )
+ ok = true;
+ else if( p >= 0 && p <= 2 ) {
+ ok = true;
+ client->profile = p;
+ }
+ else {
+ ok = false;
+ }
}
else {
if( strncmp(ns, "admin", p-ns) != 0 ) // admin only
|