bool AllElemMatchOp::matches( const MatchableDocument* doc, MatchDetails* details ) const { boost::scoped_ptr<ElementIterator> cursor( doc->getIterator( _elementPath ) ); while ( cursor->more() ) { ElementIterator::Context e = cursor->next(); if ( e.element().type() != Array ) continue; if ( _allMatch( e.element().Obj() ) ) return true; } return false; }
bool AllElemMatchOp::matches( const MatchableDocument* doc, MatchDetails* details ) const { MatchableDocument::IteratorHolder cursor( doc, &_elementPath ); while ( cursor->more() ) { ElementIterator::Context e = cursor->next(); if ( e.element().type() != Array ) continue; if ( _allMatch( e.element().Obj() ) ) return true; } return false; }
bool AllElemMatchOp::matches( const BSONObj& doc, MatchDetails* details ) const { BSONElementSet all; doc.getFieldsDotted( _path, all, false ); for ( BSONElementSet::const_iterator i = all.begin(); i != all.end(); ++i ) { BSONElement sub = *i; if ( sub.type() != Array ) continue; if ( _allMatch( sub.Obj() ) ) { return true; } } return false; }
bool AllElemMatchOp::matchesSingleElement( const BSONElement& e ) const { if ( e.type() != Array ) return false; return _allMatch( e.Obj() ); }