diff options
author | Kevin Matulef <matulef@gmail.com> | 2012-10-16 06:08:17 -0400 |
---|---|---|
committer | Kevin Matulef <matulef@gmail.com> | 2012-10-16 06:31:07 -0400 |
commit | 7db66f228efe5fa604f94fcb06e850f09920a711 (patch) | |
tree | e9449ff4cd524b8819a85d2d6939c06e7281f66f /src/mongo/db/clientcursor.h | |
parent | 58925e7afbf6f02bf604f80519922d1728ce152d (diff) | |
download | mongo-7db66f228efe5fa604f94fcb06e850f09920a711.tar.gz |
SERVER-2001 filter queries on mongod using new key extraction path
Queries on mongod must filter out documents that do not currently belong
to the shard. The belongsToMe function now uses the new key extraction
path to make this determination. An optimization is also added to the
clientcursor class so that it can make this determination using a
covered index if available.
Diffstat (limited to 'src/mongo/db/clientcursor.h')
-rw-r--r-- | src/mongo/db/clientcursor.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mongo/db/clientcursor.h b/src/mongo/db/clientcursor.h index 5498bd84acd..f77012c5fa2 100644 --- a/src/mongo/db/clientcursor.h +++ b/src/mongo/db/clientcursor.h @@ -38,6 +38,7 @@ #include "matcher.h" #include "projection.h" #include "s/d_chunk_manager.h" +#include "mongo/db/keypattern.h" namespace mongo { @@ -290,6 +291,13 @@ namespace mongo { */ BSONObj extractFields(const BSONObj &pattern , bool fillWithNull = false) ; + /** Extract elements from the object this cursor currently points to, using the expression + * specified in KeyPattern. Will use a covered index if the one in this cursor is usable. + * TODO: there are some cases where a covered index could be used but is not, for instance + * if both this index and the keyPattern are {a : "hashed"} + */ + BSONObj extractKey( const KeyPattern& usingKeyPattern ) const; + void fillQueryResultFromObj( BufBuilder &b, const MatchDetails* details = NULL ) const; bool currentIsDup() { return _c->getsetdup( _c->currLoc() ); } |