summaryrefslogtreecommitdiff
path: root/src/mongo/db/matcher/expression_array.cpp
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2013-09-09 11:35:07 -0400
committerEliot Horowitz <eliot@10gen.com>2013-09-09 11:35:41 -0400
commitc2f8b3643398d9e48611e528a64cd6e631d23018 (patch)
tree65627ac5e547a38dd0cf36eb74ecead52d333e6d /src/mongo/db/matcher/expression_array.cpp
parentc6479e89bb07063c071eb30508ed0c445feb94cb (diff)
downloadmongo-c2f8b3643398d9e48611e528a64cd6e631d23018.tar.gz
SERVER-10715: change MatchableDocument api to allow for caching of iterators
this allows a 2x performance increase for scans
Diffstat (limited to 'src/mongo/db/matcher/expression_array.cpp')
-rw-r--r--src/mongo/db/matcher/expression_array.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/mongo/db/matcher/expression_array.cpp b/src/mongo/db/matcher/expression_array.cpp
index f58875f8835..f0a09eba206 100644
--- a/src/mongo/db/matcher/expression_array.cpp
+++ b/src/mongo/db/matcher/expression_array.cpp
@@ -44,8 +44,7 @@ namespace mongo {
}
bool ArrayMatchingMatchExpression::matches( const MatchableDocument* doc, MatchDetails* details ) const {
-
- boost::scoped_ptr<ElementIterator> cursor( doc->getIterator( _elementPath ) );
+ MatchableDocument::IteratorHolder cursor( doc, &_elementPath );
while ( cursor->more() ) {
ElementIterator::Context e = cursor->next();
@@ -199,7 +198,7 @@ namespace mongo {
}
bool AllElemMatchOp::matches( const MatchableDocument* doc, MatchDetails* details ) const {
- boost::scoped_ptr<ElementIterator> cursor( doc->getIterator( _elementPath ) );
+ MatchableDocument::IteratorHolder cursor( doc, &_elementPath );
while ( cursor->more() ) {
ElementIterator::Context e = cursor->next();
if ( e.element().type() != Array )