summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/field_path.h
diff options
context:
space:
mode:
authorIan Boros <puppyofkosh@gmail.com>2019-04-18 17:07:17 -0400
committerIan Boros <puppyofkosh@gmail.com>2019-05-14 12:30:42 -0400
commite96d68d0c46b43c8fada1224436638a135731a38 (patch)
tree7c14b9cc98cdd50e43a63155f21324c6e8f97974 /src/mongo/db/pipeline/field_path.h
parentcfbd6dacb7bf4b3f5b8c3cb5e4af073a33804ba7 (diff)
downloadmongo-e96d68d0c46b43c8fada1224436638a135731a38.tar.gz
SERVER-40134 fix bug in distinct() against views
Diffstat (limited to 'src/mongo/db/pipeline/field_path.h')
-rw-r--r--src/mongo/db/pipeline/field_path.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mongo/db/pipeline/field_path.h b/src/mongo/db/pipeline/field_path.h
index 0f69ebb7043..347b236fb6b 100644
--- a/src/mongo/db/pipeline/field_path.h
+++ b/src/mongo/db/pipeline/field_path.h
@@ -78,6 +78,14 @@ public:
}
/**
+ * Get the subpath including path elements [0, n].
+ */
+ StringData getSubpath(size_t n) const {
+ invariant(n + 1 < _fieldPathDotPosition.size());
+ return StringData(_fieldPath.c_str(), _fieldPathDotPosition[n + 1]);
+ }
+
+ /**
* Return the ith field name from this path using zero-based indexes.
*/
StringData getFieldName(size_t i) const {