From ba8b57c15881ac8de4348aa35e375bc5394ce0b3 Mon Sep 17 00:00:00 2001 From: Eliot Horowitz Date: Wed, 11 Feb 2009 10:37:04 -0500 Subject: Query::toString --- client/dbclient.cpp | 4 ++++ client/dbclient.h | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/client/dbclient.cpp b/client/dbclient.cpp index 1bc3337f48a..8976b0c664e 100644 --- a/client/dbclient.cpp +++ b/client/dbclient.cpp @@ -71,6 +71,10 @@ namespace mongo { return *this; } + string Query::toString() const{ + return obj.toString(); + } + /* --- dbclientcommands --- */ inline bool DBClientWithCommands::isOk(const BSONObj& o) { diff --git a/client/dbclient.h b/client/dbclient.h index 5949cde1f00..572df9209f7 100644 --- a/client/dbclient.h +++ b/client/dbclient.h @@ -79,7 +79,7 @@ namespace mongo { Example: QUERY( "age" << 33 << "school" << "UCLA" ).sort("name") */ - class Query { + class Query : public Stringable { public: BSONObj obj; Query(const BSONObj& b) : obj(b) { } @@ -133,8 +133,10 @@ namespace mongo { */ Query& where(const char *jscode, BSONObj scope); Query& where(const char *jscode) { return where(jscode, BSONObj()); } - }; + virtual string toString() const; + }; + /** Typically one uses the QUERY(...) macro to construct a Query object. Example: QUERY( "age" << 33 << "school" << "UCLA" ) */ -- cgit v1.2.1