Example #1
0
 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;
 }
Example #2
0
 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;
 }
Example #3
0
    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;
    }
Example #4
0
    bool AllElemMatchOp::matchesSingleElement( const BSONElement& e ) const {
        if ( e.type() != Array )
            return false;

        return _allMatch( e.Obj() );
    }