summaryrefslogtreecommitdiff
path: root/src/mongo/db/exec/and_hash.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/exec/and_hash.cpp')
-rw-r--r--src/mongo/db/exec/and_hash.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/mongo/db/exec/and_hash.cpp b/src/mongo/db/exec/and_hash.cpp
index 2185b12e3c5..7569ff36703 100644
--- a/src/mongo/db/exec/and_hash.cpp
+++ b/src/mongo/db/exec/and_hash.cpp
@@ -48,6 +48,9 @@ namespace mongo {
const size_t AndHashStage::kLookAheadWorks = 10;
+ // static
+ const char* AndHashStage::kStageType = "AND_HASH";
+
AndHashStage::AndHashStage(WorkingSet* ws,
const MatchExpression* filter,
const Collection* collection)
@@ -56,6 +59,7 @@ namespace mongo {
_filter(filter),
_hashingChildren(true),
_currentChild(0),
+ _commonStats(kStageType),
_memUsage(0),
_maxMemUsage(kDefaultMaxMemUsageBytes) {}
@@ -68,6 +72,7 @@ namespace mongo {
_filter(filter),
_hashingChildren(true),
_currentChild(0),
+ _commonStats(kStageType),
_memUsage(0),
_maxMemUsage(maxMemUsage) {}
@@ -501,6 +506,13 @@ namespace mongo {
_specificStats.memLimit = _maxMemUsage;
_specificStats.memUsage = _memUsage;
+ // 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_AND_HASH));
ret->specific.reset(new AndHashStats(_specificStats));
for (size_t i = 0; i < _children.size(); ++i) {