summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/expression.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/pipeline/expression.h')
-rw-r--r--src/mongo/db/pipeline/expression.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/mongo/db/pipeline/expression.h b/src/mongo/db/pipeline/expression.h
index b9cc6dfe9b8..813b9caf91c 100644
--- a/src/mongo/db/pipeline/expression.h
+++ b/src/mongo/db/pipeline/expression.h
@@ -1485,7 +1485,11 @@ public:
class ExpressionFieldPath final : public Expression {
public:
bool isRootFieldPath() const {
- return _variable == Variables::kRootId;
+ return _variable == Variables::kRootId && _fieldPath.getPathLength() == 1;
+ }
+
+ bool isVariableReference() const {
+ return Variables::isUserDefinedVariable(_variable);
}
boost::intrusive_ptr<Expression> optimize() final;
@@ -1988,7 +1992,7 @@ public:
* Multiplies two values together as if by evaluate() on
* {$multiply: [{$const: lhs}, {$const: rhs}]}.
*
- * Note that evaluate() does not use apply() directly, because when $muliply takes more than
+ * Note that evaluate() does not use apply() directly, because when $multiply takes more than
* two arguments, it uses a wider intermediate state than Value.
*
* Returns BSONNULL if either argument is nullish.