Exemple #1
0
 LeafMatchExpression* GeoNearMatchExpression::shallowClone() const {
     GeoNearMatchExpression* next = new GeoNearMatchExpression();
     next->init( path(), NULL, _rawObj );
     next->_query = _query;
     if (getTag()) {
         next->setTag(getTag()->clone());
     }
     return next;
 }
    TEST(ExpressionGeoTest, GeoNear1) {
        BSONObj query = fromjson("{loc:{$near:{$maxDistance:100, "
                                 "$geometry:{type:\"Point\", coordinates:[0,0]}}}}");
        NearQuery nq;
        ASSERT_OK(nq.parseFrom(query["loc"].Obj()));

        GeoNearMatchExpression gne;
        ASSERT(gne.init("a", nq, query).isOK());

        // We can't match the data but we can make sure it was parsed OK.
        ASSERT_EQUALS(gne.getData().centroid.crs, SPHERE);
        ASSERT_EQUALS(gne.getData().minDistance, 0);
        ASSERT_EQUALS(gne.getData().maxDistance, 100);
    }
Exemple #3
0
 LeafMatchExpression* GeoNearMatchExpression::shallowClone() const {
     GeoNearMatchExpression* next = new GeoNearMatchExpression();
     next->init( path(), _query );
     return next;
 }