From 9b01407c9fd32d3c208346857499e745b2f5c6e8 Mon Sep 17 00:00:00 2001 From: Dwight Date: Tue, 29 Apr 2008 15:34:11 -0400 Subject: [PATCH] get profiling level --- db/query.cpp | 13 +++++++++++-- 1 file 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