Search in sources :

Example 11 with Venue

use of org.springframework.data.mongodb.core.Venue in project spring-data-mongodb by spring-projects.

the class GeoSpatial2DSphereTests method nearSphereWithMinDistance.

// DATAMONGO-1110
@Test
public void nearSphereWithMinDistance() {
    Point point = new Point(-73.99171, 40.738868);
    List<Venue> venues = template.find(query(where("location").nearSphere(point).minDistance(0.01)), Venue.class);
    assertThat(venues.size(), is(1));
}
Also used : Venue(org.springframework.data.mongodb.core.Venue) Point(org.springframework.data.geo.Point) Test(org.junit.Test)

Aggregations

Venue (org.springframework.data.mongodb.core.Venue)11 Test (org.junit.Test)10 Point (org.springframework.data.geo.Point)5 NearQuery (org.springframework.data.mongodb.core.query.NearQuery)4 Circle (org.springframework.data.geo.Circle)2 Metric (org.springframework.data.geo.Metric)2 Document (org.bson.Document)1 Box (org.springframework.data.geo.Box)1 Polygon (org.springframework.data.geo.Polygon)1 Aggregation (org.springframework.data.mongodb.core.aggregation.Aggregation)1 GeospatialIndex (org.springframework.data.mongodb.core.index.GeospatialIndex)1 Query (org.springframework.data.mongodb.core.query.Query)1