diff options
author | Eliot Horowitz <eliot@10gen.com> | 2010-07-21 17:30:56 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2010-07-21 17:30:56 -0400 |
commit | fde8b9a5804b1f722f7df19ca5084e420f4a447d (patch) | |
tree | fa5230deb58c58d70b4f8d795e68ef5015597a0e | |
parent | 5d15e3494f9ff8161e30b14b7828910cd94d0065 (diff) | |
download | mongo-fde8b9a5804b1f722f7df19ca5084e420f4a447d.tar.gz |
hack for findOne
-rw-r--r-- | dbtests/mockdbclient.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/dbtests/mockdbclient.h b/dbtests/mockdbclient.h index 8fbec0978ec..ba5a125cb95 100644 --- a/dbtests/mockdbclient.h +++ b/dbtests/mockdbclient.h @@ -26,7 +26,7 @@ class MockDBClientConnection : public DBClientConnection { public: MockDBClientConnection() : connect_() {} virtual - BSONObj findOne(const string &ns, Query query, const BSONObj *fieldsToReturn = 0, int queryOptions = 0) { + BSONObj findOne(const string &ns, const Query& query, const BSONObj *fieldsToReturn = 0, int queryOptions = 0) { return one_; } virtual @@ -63,11 +63,12 @@ public: rp_( rp ), cc_( cc ) { } - virtual BSONObj findOne(const string &ns, Query query, const BSONObj *fieldsToReturn = 0, int queryOptions = 0) { + virtual BSONObj findOne(const string &ns, const Query& query, const BSONObj *fieldsToReturn = 0, int queryOptions = 0) { + BSONObj c = query.obj.copy(); if ( cc_ ) cc_->beforeCommand(); SetGlobalReplPair s( rp_ ); BSONObjBuilder result; - result.append( "ok", Command::runAgainstRegistered( "admin.$cmd", query.obj, result ) ? 1.0 : 0.0 ); + result.append( "ok", Command::runAgainstRegistered( "admin.$cmd", c, result ) ? 1.0 : 0.0 ); if ( cc_ ) cc_->afterCommand(); return result.obj(); } |