summaryrefslogtreecommitdiff
path: root/src/mongo/db/matcher/path.cpp
diff options
context:
space:
mode:
authorBlake Oler <blake.oler@10gen.com>2017-09-11 16:05:43 -0400
committerKyle Suarez <kyle.suarez@mongodb.com>2017-11-14 13:52:23 -0500
commitacde99b058c6e23302bc849015ed5e90b15b19fc (patch)
treecc1775bd2272048d55c936b3f4c259931f8409d6 /src/mongo/db/matcher/path.cpp
parent4abdc7aff5cd5d0531c53b0ff784826e96700418 (diff)
downloadmongo-acde99b058c6e23302bc849015ed5e90b15b19fc.tar.gz
SERVER-30783 Move init() logic to MatchExpression constructors
Diffstat (limited to 'src/mongo/db/matcher/path.cpp')
-rw-r--r--src/mongo/db/matcher/path.cpp17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/mongo/db/matcher/path.cpp b/src/mongo/db/matcher/path.cpp
index a55da25879d..8ecd2a99473 100644
--- a/src/mongo/db/matcher/path.cpp
+++ b/src/mongo/db/matcher/path.cpp
@@ -35,11 +35,10 @@
namespace mongo {
-Status ElementPath::init(StringData path) {
+void ElementPath::init(StringData path) {
_shouldTraverseNonleafArrays = true;
_shouldTraverseLeafArray = true;
_fieldRef.parse(path);
- return Status::OK();
}
// -----
@@ -194,10 +193,8 @@ bool BSONElementIterator::subCursorHasMore() {
}
_subCursorPath.reset(new ElementPath());
- _subCursorPath
- ->init(_arrayIterationState.restOfPath.substr(
- _arrayIterationState.nextPieceOfPath.size() + 1))
- .transitional_ignore();
+ _subCursorPath->init(_arrayIterationState.restOfPath.substr(
+ _arrayIterationState.nextPieceOfPath.size() + 1));
_subCursorPath->setTraverseLeafArray(_path->shouldTraverseLeafArray());
// If we're here, we must be able to traverse nonleaf arrays.
@@ -277,7 +274,7 @@ bool BSONElementIterator::more() {
// The current array element is a subdocument. See if the subdocument generates
// any elements matching the remaining subpath.
_subCursorPath.reset(new ElementPath());
- _subCursorPath->init(_arrayIterationState.restOfPath).transitional_ignore();
+ _subCursorPath->init(_arrayIterationState.restOfPath);
_subCursorPath->setTraverseLeafArray(_path->shouldTraverseLeafArray());
_subCursor.reset(new BSONElementIterator(_subCursorPath.get(), eltInArray.Obj()));
@@ -303,10 +300,8 @@ bool BSONElementIterator::more() {
// The current array element is itself an array. See if the nested array
// has any elements matching the remainihng.
_subCursorPath.reset(new ElementPath());
- _subCursorPath
- ->init(_arrayIterationState.restOfPath.substr(
- _arrayIterationState.nextPieceOfPath.size() + 1))
- .transitional_ignore();
+ _subCursorPath->init(_arrayIterationState.restOfPath.substr(
+ _arrayIterationState.nextPieceOfPath.size() + 1));
_subCursorPath->setTraverseLeafArray(_path->shouldTraverseLeafArray());
BSONElementIterator* real = new BSONElementIterator(
_subCursorPath.get(), _arrayIterationState._current.Obj());