diff options
Diffstat (limited to 'src/mongo/s/query/cluster_find.h')
-rw-r--r-- | src/mongo/s/query/cluster_find.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/mongo/s/query/cluster_find.h b/src/mongo/s/query/cluster_find.h index ad878a11b37..7a7d3deac69 100644 --- a/src/mongo/s/query/cluster_find.h +++ b/src/mongo/s/query/cluster_find.h @@ -33,6 +33,7 @@ #include "mongo/bson/bsonobj.h" #include "mongo/db/cursor_id.h" #include "mongo/db/query/cursor_response.h" +#include "mongo/db/query/explain_common.h" namespace mongo { @@ -43,6 +44,10 @@ class OperationContext; struct GetMoreRequest; struct ReadPreferenceSetting; +namespace rpc { +class ServerSelectionMetadata; +} // namespace rpc + /** * Methods for running find and getMore operations across a sharded cluster. */ @@ -71,6 +76,21 @@ public: const GetMoreRequest& request); /** + * Helper to run an explain of a find operation on the shards. Fills 'out' with the result of + * the of the explain command on success. On failure, returns a non-OK status and does not + * modify 'out'. + * + * Used both if mongos receives an explain command and if it receives an OP_QUERY find with the + * $explain modifier. + */ + static Status runExplain(OperationContext* txn, + const BSONObj& findCommand, + const LiteParsedQuery& lpq, + ExplainCommon::Verbosity verbosity, + const rpc::ServerSelectionMetadata& serverSelectionMetadata, + BSONObjBuilder* out); + + /** * Extracts the read preference from 'cmdObj', or determines the read pref based on 'isSlaveOk' * if 'cmdObj' does not contain a read preference. * |