diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/pipeline/expression.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/mongo/db/pipeline/expression.cpp b/src/mongo/db/pipeline/expression.cpp index a1b99d4d307..0fce881ba18 100644 --- a/src/mongo/db/pipeline/expression.cpp +++ b/src/mongo/db/pipeline/expression.cpp @@ -3443,14 +3443,14 @@ public: } virtual Value evaluate(const Document& root, Variables* variables) const { - - auto args = evaluateAndValidateArguments(root, _children, _indexMap.size(), variables); + int arraySize = _children[0]->evaluate(root, variables).getArrayLength(); + auto args = evaluateAndValidateArguments(root, _children, arraySize, variables); auto indexVec = _indexMap.find(args.targetOfSearch); if (indexVec == _indexMap.end()) return Value(-1); - // Search through the vector of indecies for first index in our range. + // Search through the vector of indexes for first index in our range. for (auto index : indexVec->second) { if (index >= args.startIndex && index < args.endIndex) { return Value(index); |