summaryrefslogtreecommitdiff
path: root/src/mongo/db/field_ref.cpp
diff options
context:
space:
mode:
authorTed Tuckman <ted.tuckman@mongodb.com>2019-05-08 11:12:49 -0400
committerTed Tuckman <ted.tuckman@mongodb.com>2019-05-28 17:43:57 -0400
commit530167637e22f2cff3ddd8551f3229db6ed97824 (patch)
tree3c42daa85a74c951fd5d63e03cf7ded1cc867827 /src/mongo/db/field_ref.cpp
parentfc6edc2f454ae29b1daaa0f2547b8204aa27bf72 (diff)
downloadmongo-530167637e22f2cff3ddd8551f3229db6ed97824.tar.gz
SERVER-40826 Add getters to projection nodes
Diffstat (limited to 'src/mongo/db/field_ref.cpp')
-rw-r--r--src/mongo/db/field_ref.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/mongo/db/field_ref.cpp b/src/mongo/db/field_ref.cpp
index 35bc6a25a5c..c919a5df7c9 100644
--- a/src/mongo/db/field_ref.cpp
+++ b/src/mongo/db/field_ref.cpp
@@ -139,6 +139,16 @@ void FieldRef::removeLastPart() {
_size--;
}
+void FieldRef::removeFirstPart() {
+ if (_size == 0) {
+ return;
+ }
+ for (size_t i = 0; i + 1 < _size; ++i) {
+ setPart(i, getPart(i + 1));
+ }
+ removeLastPart();
+}
+
size_t FieldRef::appendParsedPart(FieldRef::StringView part) {
if (_size < kReserveAhead) {
_fixed[_size] = part;