summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/expression.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/pipeline/expression.cpp')
-rw-r--r--src/mongo/db/pipeline/expression.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/mongo/db/pipeline/expression.cpp b/src/mongo/db/pipeline/expression.cpp
index 932c8404210..83fe6400e20 100644
--- a/src/mongo/db/pipeline/expression.cpp
+++ b/src/mongo/db/pipeline/expression.cpp
@@ -2649,6 +2649,21 @@ std::unique_ptr<Expression> ExpressionFieldPath::copyWithSubstitution(
return nullptr;
}
+bool ExpressionFieldPath::isRenameableByAnyPrefixNameIn(
+ const StringMap<std::string>& renameList) const {
+ if (_variable != Variables::kRootId || _fieldPath.getPathLength() == 1) {
+ return false;
+ }
+
+ FieldRef path(getFieldPathWithoutCurrentPrefix().fullPath());
+ for (const auto& rename : renameList) {
+ if (FieldRef oldName(rename.first); oldName.isPrefixOfOrEqualTo(path)) {
+ return true;
+ }
+ }
+ return false;
+}
+
monotonic::State ExpressionFieldPath::getMonotonicState(const FieldPath& sortedFieldPath) const {
return getFieldPathWithoutCurrentPrefix() == sortedFieldPath ? monotonic::State::Increasing
: monotonic::State::NonMonotonic;