Exemplo n.º 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;
 }
Exemplo n.º 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}}")));

    }
Exemplo n.º 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}}")));

    }
Exemplo n.º 4
0
 LeafMatchExpression* GeoMatchExpression::shallowClone() const {
     GeoMatchExpression* next = new GeoMatchExpression();
     next->init( path(), _query );
     return next;
 }