Spring Endpoint for data break / search using MongoDB geodata types (circle, dot)

I am trying to implement a location search using Spring Data REST and MongoDB. Firstly, I created a model.

public class Event {

    @Id
    private String id;

    private String name;
    private String description;
    private double[] position;

    .. getter setter ..
}

Secondly, I added a repository.

public interface EventRepository extends MongoRepository<Event, String> {

    List<Event> findByName(@Param("name") String name);

    List<Event> findByPositionWithin(@Param("circle") Circle c);

    List<Event> findByPositionNear(@Param("point") Point p, @Param("distance") Distance d);

}

However, now I am facing the problem that I do not know how to call the / search endpoint for findByPositionWithin and findByPositionNear? I cannot find any links or documents how to pass a complex type to a method.

FindByName / search / findByName endpoint events? name = test work well. How to pass a circle parameter? Do I need to write a personalized message conversion?

Hope someone has some tips :)

+4

All Articles