示例#1
0
 LeafMatchExpression* GeoMatchExpression::shallowClone() const {
     GeoMatchExpression* next = new GeoMatchExpression();
     next->init( path(), NULL, _rawObj);
     next->_query = _query;
     if (getTag()) {
         next->setTag(getTag()->clone());
     }
     return next;
 }
示例#2
0
    TEST( ExpressionGeoTest, Geo1 ) {
        BSONObj query = fromjson("{loc:{$within:{$box:[{x: 4, y:4},[6,6]]}}}");

        GeoQuery gq;
        ASSERT( gq.parseFrom( query["loc"].Obj() ) );

        GeoMatchExpression ge;
        ASSERT( ge.init( "a", gq ).isOK() );

        ASSERT(!ge.matches(fromjson("{a: [3,4]}")));
        ASSERT(ge.matches(fromjson("{a: [4,4]}")));
        ASSERT(ge.matches(fromjson("{a: [5,5]}")));
        ASSERT(ge.matches(fromjson("{a: [5,5.1]}")));
        ASSERT(ge.matches(fromjson("{a: {x: 5, y:5.1}}")));

    }
示例#3
0
    TEST( ExpressionGeoTest, Geo1 ) {
        BSONObj query = fromjson("{loc:{$within:{$box:[{x: 4, y:4},[6,6]]}}}");

        auto_ptr<GeoQuery> gq(new GeoQuery);
        ASSERT( gq->parseFrom( query["loc"].Obj() ) );

        GeoMatchExpression ge;
        ASSERT( ge.init("a", gq.release(), query ).isOK() );

        ASSERT(!ge.matchesBSON(fromjson("{a: [3,4]}")));
        ASSERT(ge.matchesBSON(fromjson("{a: [4,4]}")));
        ASSERT(ge.matchesBSON(fromjson("{a: [5,5]}")));
        ASSERT(ge.matchesBSON(fromjson("{a: [5,5.1]}")));
        ASSERT(ge.matchesBSON(fromjson("{a: {x: 5, y:5.1}}")));

    }
示例#4
0
 LeafMatchExpression* GeoMatchExpression::shallowClone() const {
     GeoMatchExpression* next = new GeoMatchExpression();
     next->init( path(), _query );
     return next;
 }