summaryrefslogtreecommitdiff
path: root/src/mongo/db/exec/fetch.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/exec/fetch.cpp')
-rw-r--r--src/mongo/db/exec/fetch.cpp23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/mongo/db/exec/fetch.cpp b/src/mongo/db/exec/fetch.cpp
index 8077dcacdb6..c8c0ff105dd 100644
--- a/src/mongo/db/exec/fetch.cpp
+++ b/src/mongo/db/exec/fetch.cpp
@@ -37,14 +37,18 @@
namespace mongo {
- FetchStage::FetchStage(WorkingSet* ws,
- PlanStage* child,
- const MatchExpression* filter,
+ // static
+ const char* FetchStage::kStageType = "FETCH";
+
+ FetchStage::FetchStage(WorkingSet* ws,
+ PlanStage* child,
+ const MatchExpression* filter,
const Collection* collection)
: _collection(collection),
- _ws(ws),
- _child(child),
- _filter(filter) { }
+ _ws(ws),
+ _child(child),
+ _filter(filter),
+ _commonStats(kStageType) { }
FetchStage::~FetchStage() { }
@@ -143,6 +147,13 @@ namespace mongo {
PlanStageStats* FetchStage::getStats() {
_commonStats.isEOF = isEOF();
+ // Add a BSON representation of the filter to the stats tree, if there is one.
+ if (NULL != _filter) {
+ BSONObjBuilder bob;
+ _filter->toBSON(&bob);
+ _commonStats.filter = bob.obj();
+ }
+
auto_ptr<PlanStageStats> ret(new PlanStageStats(_commonStats, STAGE_FETCH));
ret->specific.reset(new FetchStats(_specificStats));
ret->children.push_back(_child->getStats());