diff options
author | Eliot Horowitz <eliot@10gen.com> | 2009-02-11 10:37:04 -0500 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2009-02-11 10:37:04 -0500 |
commit | ba8b57c15881ac8de4348aa35e375bc5394ce0b3 (patch) | |
tree | 24d95e7aa245b389ae4e6db0c2044b5a0368f2da | |
parent | bdc7d90b852ec294995f16afcc48c0238db789aa (diff) | |
download | mongo-ba8b57c15881ac8de4348aa35e375bc5394ce0b3.tar.gz |
Query::toString
-rw-r--r-- | client/dbclient.cpp | 4 | ||||
-rw-r--r-- | 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" ) */ |