Returned metric from GeoNear query with spring data mongodb
I asked the same question on stackoverflow without much luck.
In my repository I have this method:
Code:
GeoPage<MyType> findByLocNear(Point location, Distance distance, Pageable pageable);
If I pass to it a Distance with Metrics.Kilometers, the GeoResults in the GeoPage have the distance with Metric.Neutral. Is this the correct behavior or am I missing something? I can get the correct value moltiplying the distance value by 6378.137, but still, I'm confused on how this should work.
Test:
Code:
GeoPage<MyObject> results = myObjectRepository.findByLocNear(new Point(9.1916, 45.464), new Distance(500, Metrics.KILOMETERS),new PageRequest(0, 10));
assertEquals("KILOMETERS", results.getContent().get(0).getDistance().getMetric());
result:
Code:
java.lang.AssertionError: expected:<KILOMETERS> but was:<NEUTRAL>