summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--db/clientcursor.h3
-rw-r--r--db/instance.cpp2
-rw-r--r--db/query.cpp4
-rw-r--r--db/query.h2
4 files changed, 7 insertions, 4 deletions
diff --git a/db/clientcursor.h b/db/clientcursor.h
index ee725788696..79907ea2424 100644
--- a/db/clientcursor.h
+++ b/db/clientcursor.h
@@ -51,7 +51,7 @@ namespace mongo {
DiskLoc _lastLoc; // use getter and setter not this (important)
unsigned _idleAgeMillis; // how long has the cursor been around, relative to server idle time
bool _liveForever; // if true, never time out cursor
-
+
static CCById clientCursorsById;
static CCByLoc byLoc;
static boost::recursive_mutex ccmutex; // must use this for all statics above!
@@ -64,6 +64,7 @@ namespace mongo {
auto_ptr<KeyValJSMatcher> matcher;
auto_ptr<Cursor> c;
int pos; // # objects into the cursor so far
+ BSONObj query;
ClientCursor() : _idleAgeMillis(0), _liveForever(false), pos(0) {
recursive_boostlock lock(ccmutex);
diff --git a/db/instance.cpp b/db/instance.cpp
index 3b15516748b..8b039cb2d7e 100644
--- a/db/instance.cpp
+++ b/db/instance.cpp
@@ -469,7 +469,7 @@ namespace mongo {
try {
AuthenticationInfo *ai = currentClient.get()->ai;
uassert("unauthorized", ai->isAuthorized(cc().database()->name.c_str()));
- msgdata = getMore(ns, ntoreturn, cursorid);
+ msgdata = getMore(ns, ntoreturn, cursorid, ss);
}
catch ( AssertionException& e ) {
ss << " exception " + e.toString();
diff --git a/db/query.cpp b/db/query.cpp
index a31ad048023..26412748798 100644
--- a/db/query.cpp
+++ b/db/query.cpp
@@ -971,7 +971,7 @@ namespace mongo {
return qr;
}
- QueryResult* getMore(const char *ns, int ntoreturn, long long cursorid) {
+ QueryResult* getMore(const char *ns, int ntoreturn, long long cursorid , stringstream& ss) {
ClientCursor *cc = ClientCursor::find(cursorid);
int bufSize = 512;
@@ -993,6 +993,7 @@ namespace mongo {
resultFlags = QueryResult::ResultFlag_CursorNotFound;
}
else {
+ ss << " query: " << cc->query << " ";
start = cc->pos;
Cursor *c = cc->c.get();
c->checkLocation();
@@ -1529,6 +1530,7 @@ namespace mongo {
cc->liveForever();
cc->c = c;
cursorid = cc->cursorid;
+ cc->query = jsobj.getOwned();
DEV out() << " query has more, cursorid: " << cursorid << endl;
cc->matcher = dqo.matcher();
// cc->ids_ = dqo.ids();
diff --git a/db/query.h b/db/query.h
index 246f7881829..3a4f975ba51 100644
--- a/db/query.h
+++ b/db/query.h
@@ -72,7 +72,7 @@
namespace mongo {
// for an existing query (ie a ClientCursor), send back additional information.
- QueryResult* getMore(const char *ns, int ntoreturn, long long cursorid);
+ QueryResult* getMore(const char *ns, int ntoreturn, long long cursorid , stringstream& ss);
/* returns true if an existing object was updated, false if no existing object was found.
multi - update multiple objects - mostly useful with things like $set