diff --git a/db/query.cpp b/db/query.cpp index 439975fc2b6..341227e8ab4 100644 --- a/db/query.cpp +++ b/db/query.cpp @@ -511,7 +511,10 @@ namespace mongo { {} virtual void init() { - _buf.skip( sizeof( QueryResult ) ); + // only need to put the QueryResult fields there if we're building the first buffer in the message. + if ( _response.empty() ) { + _buf.skip( sizeof( QueryResult ) ); + } if ( _oplogReplay ) { _findingStartCursor.reset( new FindingStartCursor( qp() ) ); @@ -659,7 +662,11 @@ namespace mongo { virtual bool mayRecordPlan() const { return _pq.getNumToReturn() != 1; } virtual QueryOp *clone() const { - return new UserQueryOp( _pq, _response, _explainSuffix, _curop ); + UserQueryOp *ret = new UserQueryOp( _pq, _response, _explainSuffix, _curop ); + ret->_n = _n; +// ret->_nscanned = _nscanned; +// ret->_nscannedObjects = _nscannedObjects; + return ret; } bool scanAndOrderRequired() const { return _inMemSort; } diff --git a/db/queryoptimizer.cpp b/db/queryoptimizer.cpp index cc0e74faac8..b0207041214 100644 --- a/db/queryoptimizer.cpp +++ b/db/queryoptimizer.cpp @@ -559,8 +559,7 @@ namespace mongo { _honorRecordedPlan( honorRecordedPlan ) { // _fros( ns, query ) { // eventually implement (some of?) these - // current hint test prevents _or when doing a full query, which we want right now since we need to implement other stuff before turning that on - if ( !order.isEmpty() || ( hint /*&& !hint->eoo()*/ ) || !min.isEmpty() || !max.isEmpty() ) { + if ( !order.isEmpty() || ( hint && !hint->eoo() ) || !min.isEmpty() || !max.isEmpty() ) { _or = false; } if ( !_or ) {