| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448 |
- "use strict"
- // Autogenerated by cport.py on 2013-09-17 14:37
- var Matcher2 = module.exports = function (){
- }, klass = Matcher2, base = Object , proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
- // File: matcher.h lines: 82-82
- // boost::scoped_ptr<MatchExpression> _expression;
- proto._expression = undefined;
- // File: matcher.h lines: 80-80
- // BSONObj _indexKey;
- proto._indexKey = undefined;
- // File: matcher.h lines: 79-79
- // BSONObj _pattern;
- proto._pattern = undefined;
- // File: matcher.h lines: 84-84
- // IndexSpliceInfo _spliceInfo;
- proto._spliceInfo = undefined;
- // File: matcher.h lines: 82-82
- // boost::scoped_ptr<MatchExpression> _expression;
- proto._expression = undefined;
- // File: matcher.h lines: 80-80
- // BSONObj _indexKey;
- proto._indexKey = undefined;
- // File: matcher.h lines: 79-79
- // BSONObj _pattern;
- proto._pattern = undefined;
- // File: matcher.h lines: 84-84
- // IndexSpliceInfo _spliceInfo;
- proto._spliceInfo = undefined;
- /**
- *
- * This documentation was automatically generated. Please update when you touch this function.
- * @method Matcher2
- * @param
- *
- */
- proto.Matcher2 = function Matcher2( /* const Matcher2 &docMatcher, const BSONObj &constrainIndexKey */ ){
- // File: matcher.cpp lines: 94-102
- // Matcher2::Matcher2( const Matcher2 &docMatcher, const BSONObj &constrainIndexKey )
- // : _indexKey( constrainIndexKey ) {
- //
- // MatchExpression* indexExpression = spliceForIndex( constrainIndexKey,
- // docMatcher._expression.get(),
- // &_spliceInfo );
- // if ( indexExpression ) {
- // _expression.reset( indexExpression );
- // }
- // }
- }
- /**
- *
- * This documentation was automatically generated. Please update when you touch this function.
- * @method _spliceForIndex
- * @param
- *
- */
- proto._spliceForIndex = function _spliceForIndex( /* const set<string>& keys,$/;" */ ){
- // File: matcher.cpp lines: 236-380
- // MatchExpression* Matcher2::_spliceForIndex( const set<string>& keys,
- // const MatchExpression* full,
- // Matcher2::IndexSpliceInfo* spliceInfo ) {
- //
- // switch ( full->matchType() ) {
- // case MatchExpression::ALWAYS_FALSE:
- // return new FalseMatchExpression();
- //
- // case MatchExpression::GEO_NEAR:
- // case MatchExpression::NOT:
- // case MatchExpression::NOR:
- // // maybe?
- // return NULL;
- //
- // case MatchExpression::OR:
- //
- // case MatchExpression::AND: {
- // auto_ptr<ListOfMatchExpression> dup;
- // for ( unsigned i = 0; i < full->numChildren(); i++ ) {
- // MatchExpression* sub = _spliceForIndex( keys, full->getChild( i ), spliceInfo );
- // if ( !sub )
- // continue;
- // if ( !dup.get() ) {
- // if ( full->matchType() == MatchExpression::AND )
- // dup.reset( new AndMatchExpression() );
- // else
- // dup.reset( new OrMatchExpression() );
- // }
- // dup->add( sub );
- // }
- // if ( dup.get() ) {
- // if ( full->matchType() == MatchExpression::OR &&
- // dup->numChildren() != full->numChildren() ) {
- // // TODO: I think this should actuall get a list of all the fields
- // // and make sure that's the same
- // // with an $or, have to make sure its all or nothing
- // return NULL;
- // }
- // return dup.release();
- // }
- // return NULL;
- // }
- //
- // case MatchExpression::EQ: {
- // const ComparisonMatchExpression* cmp =
- // static_cast<const ComparisonMatchExpression*>( full );
- //
- // if ( cmp->getRHS().type() == Array ) {
- // // need to convert array to an $in
- //
- // if ( !keys.count( cmp->path().toString() ) )
- // return NULL;
- //
- // auto_ptr<InMatchExpression> newIn( new InMatchExpression() );
- // newIn->init( cmp->path() );
- //
- // if ( newIn->getArrayFilterEntries()->addEquality( cmp->getRHS() ).isOK() )
- // return NULL;
- //
- // if ( cmp->getRHS().Obj().isEmpty() )
- // newIn->getArrayFilterEntries()->addEquality( myUndefinedElement );
- //
- // BSONObjIterator i( cmp->getRHS().Obj() );
- // while ( i.more() ) {
- // Status s = newIn->getArrayFilterEntries()->addEquality( i.next() );
- // if ( !s.isOK() )
- // return NULL;
- // }
- //
- // return newIn.release();
- // }
- // else if ( cmp->getRHS().type() == jstNULL ) {
- // //spliceInfo->hasNullEquality = true;
- // return NULL;
- // }
- // }
- //
- // case MatchExpression::LTE:
- // case MatchExpression::LT:
- // case MatchExpression::GT:
- // case MatchExpression::GTE: {
- // const ComparisonMatchExpression* cmp =
- // static_cast<const ComparisonMatchExpression*>( full );
- //
- // if ( cmp->getRHS().type() == jstNULL ) {
- // // null and indexes don't play nice
- // //spliceInfo->hasNullEquality = true;
- // return NULL;
- // }
- // }
- // case MatchExpression::REGEX:
- // case MatchExpression::MOD: {
- // const LeafMatchExpression* lme = static_cast<const LeafMatchExpression*>( full );
- // if ( !keys.count( lme->path().toString() ) )
- // return NULL;
- // return lme->shallowClone();
- // }
- //
- // case MatchExpression::MATCH_IN: {
- // const LeafMatchExpression* lme = static_cast<const LeafMatchExpression*>( full );
- // if ( !keys.count( lme->path().toString() ) )
- // return NULL;
- // InMatchExpression* cloned = static_cast<InMatchExpression*>(lme->shallowClone());
- // if ( cloned->getArrayFilterEntries()->hasEmptyArray() )
- // cloned->getArrayFilterEntries()->addEquality( myUndefinedElement );
- //
- // // since { $in : [[1]] } matches [1], need to explode
- // for ( BSONElementSet::const_iterator i = cloned->getArrayFilterEntries()->equalities().begin();
- // i != cloned->getArrayFilterEntries()->equalities().end();
- // ++i ) {
- // const BSONElement& x = *i;
- // if ( x.type() == Array ) {
- // BSONObjIterator j( x.Obj() );
- // while ( j.more() ) {
- // cloned->getArrayFilterEntries()->addEquality( j.next() );
- // }
- // }
- // }
- //
- // return cloned;
- // }
- //
- // case MatchExpression::ALL:
- // // TODO: conver to $in
- // return NULL;
- //
- // case MatchExpression::ELEM_MATCH_OBJECT:
- // case MatchExpression::ELEM_MATCH_VALUE:
- // // future
- // return NULL;
- //
- // case MatchExpression::GEO:
- // case MatchExpression::SIZE:
- // case MatchExpression::EXISTS:
- // case MatchExpression::NIN:
- // case MatchExpression::TYPE_OPERATOR:
- // case MatchExpression::ATOMIC:
- // case MatchExpression::WHERE:
- // // no go
- // return NULL;
- //
- //
- // }
- //
- // return NULL;
- // }
- }
- /**
- *
- * This documentation was automatically generated. Please update when you touch this function.
- * @method atomic
- * @param
- *
- */
- proto.atomic = function atomic( /* */ ){
- // File: matcher.cpp lines: 120-133
- // bool Matcher2::atomic() const {
- // if ( !_expression )
- // return false;
- //
- // if ( _expression->matchType() == MatchExpression::ATOMIC )
- // return true;
- //
- // // we only go down one level
- // for ( unsigned i = 0; i < _expression->numChildren(); i++ ) {
- // if ( _expression->getChild( i )->matchType() == MatchExpression::ATOMIC )
- // return true;
- // }
- //
- // return false;
- // }
- }
- /**
- *
- * This documentation was automatically generated. Please update when you touch this function.
- * @method getQuery
- * @param
- *
- */
- proto.getQuery = function getQuery( /* */ ){
- // File: matcher.h lines: 65-64
- // const BSONObj* getQuery() const { return &_pattern; };
- }
- /**
- *
- * This documentation was automatically generated. Please update when you touch this function.
- * @method hasExistsFalse
- * @param
- *
- */
- proto.hasExistsFalse = function hasExistsFalse( /* */ ){
- // File: matcher.cpp lines: 172-180
- // bool Matcher2::hasExistsFalse() const {
- // if ( _spliceInfo.hasNullEquality ) {
- // // { a : NULL } is very dangerous as it may not got indexed in some cases
- // // so we just totally ignore
- // return true;
- // }
- //
- // return _isExistsFalse( _expression.get(), false,
- // _expression->matchType() == MatchExpression::AND ? -1 : 0 );
- // }
- }
- /**
- *
- * This documentation was automatically generated. Please update when you touch this function.
- * @method keyMatch
- * @param
- *
- */
- proto.keyMatch = function keyMatch( /* const Matcher2 &docMatcher */ ){
- // File: matcher.cpp lines: 199-206
- // bool Matcher2::keyMatch( const Matcher2 &docMatcher ) const {
- // if ( !_expression )
- // return docMatcher._expression.get() == NULL;
- // if ( !docMatcher._expression )
- // return false;
- // if ( _spliceInfo.hasNullEquality )
- // return false;
- // return _expression->equivalent( docMatcher._expression.get() );
- // }
- }
- /**
- *
- * This documentation was automatically generated. Please update when you touch this function.
- * @method matches
- * @param
- *
- */
- proto.matches = function matches( /* const BSONObj& doc, MatchDetails* details */ ){
- // File: matcher.cpp lines: 105-116
- // bool Matcher2::matches(const BSONObj& doc, MatchDetails* details ) const {
- // if ( !_expression )
- // return true;
- //
- // if ( _indexKey.isEmpty() )
- // return _expression->matchesBSON( doc, details );
- //
- // if ( !doc.isEmpty() && doc.firstElement().fieldName()[0] )
- // return _expression->matchesBSON( doc, details );
- //
- // IndexKeyMatchableDocument mydoc( _indexKey, doc );
- // return _expression->matches( &mydoc, details );
- // }
- }
- /**
- *
- * This documentation was automatically generated. Please update when you touch this function.
- * @method singleSimpleCriterion
- * @param
- *
- */
- proto.singleSimpleCriterion = function singleSimpleCriterion( /* */ ){
- // File: matcher.cpp lines: 184-196
- // bool Matcher2::singleSimpleCriterion() const {
- // if ( !_expression )
- // return false;
- //
- // if ( _expression->matchType() == MatchExpression::EQ )
- // return true;
- //
- // if ( _expression->matchType() == MatchExpression::AND &&
- // _expression->numChildren() == 1 &&
- // _expression->getChild(0)->matchType() == MatchExpression::EQ )
- // return true;
- //
- // return false;
- // }
- }
- /**
- *
- * This documentation was automatically generated. Please update when you touch this function.
- * @method spliceForIndex
- * @param
- *
- */
- proto.spliceForIndex = function spliceForIndex( /* const BSONObj& key,$/;" */ ){
- // File: matcher.cpp lines: 209-217
- // MatchExpression* Matcher2::spliceForIndex( const BSONObj& key,
- // const MatchExpression* full,
- // Matcher2::IndexSpliceInfo* spliceInfo ) {
- // set<string> keys;
- // for ( BSONObjIterator i(key); i.more(); ) {
- // BSONElement e = i.next();
- // keys.insert( e.fieldName() );
- // }
- // return _spliceForIndex( keys, full, spliceInfo );
- // }
- }
- /**
- *
- * This documentation was automatically generated. Please update when you touch this function.
- * @method toString
- * @param
- *
- */
- proto.toString = function toString( /* */ ){
- // File: matcher.h lines: 66-65
- // std::string toString() const { return _pattern.toString(); }
- }
|