Skip to content

Commit de33734

Browse files
christophstroblmp911de
authored andcommitted
Polishing
Update Javadoc to mention unit of measure for min/maxDistance depending on usage of geoJson. Also remove unused imports from tests See #4004 Original pull request: #4006.
1 parent c272c73 commit de33734

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/Criteria.java

+10-3
Original file line numberDiff line numberDiff line change
@@ -624,9 +624,13 @@ public Criteria intersects(GeoJson geoJson) {
624624
}
625625

626626
/**
627-
* Creates a geo-spatial criterion using a {@literal $maxDistance} operation, for use with $near
627+
* Creates a geo-spatial criterion using a {@literal $maxDistance} operation, for use with {@literal $near} or
628+
* {@literal $nearSphere}.
629+
* <p>
630+
* <strong>NOTE:</strong> The unit of measure for distance may depends on the used coordinate representation
631+
* (legacy vs. geoJson) as well as the target operation.
628632
*
629-
* @param maxDistance
633+
* @param maxDistance radians or meters
630634
* @return this.
631635
* @see <a href="https://docs.mongodb.com/manual/reference/operator/query/maxDistance/">MongoDB Query operator:
632636
* $maxDistance</a>
@@ -645,8 +649,11 @@ public Criteria maxDistance(double maxDistance) {
645649
/**
646650
* Creates a geospatial criterion using a {@literal $minDistance} operation, for use with {@literal $near} or
647651
* {@literal $nearSphere}.
652+
* <p>
653+
* <strong>NOTE:</strong> The unit of measure for distance may depends on the used coordinate representation
654+
* (legacy vs. geoJson) as well as the target operation.
648655
*
649-
* @param minDistance
656+
* @param minDistance radians or meters
650657
* @return this.
651658
* @since 1.7
652659
*/

spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/CountQueryUnitTests.java

-4
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,13 @@
1515
*/
1616
package org.springframework.data.mongodb.core;
1717

18-
import static org.mockito.Mockito.*;
1918
import static org.springframework.data.mongodb.core.query.Criteria.*;
2019
import static org.springframework.data.mongodb.core.query.Query.*;
2120
import static org.springframework.data.mongodb.test.util.Assertions.*;
2221

2322
import org.junit.jupiter.api.BeforeEach;
2423
import org.junit.jupiter.api.Test;
25-
2624
import org.springframework.data.geo.Point;
27-
import org.springframework.data.mongodb.MongoDatabaseFactory;
28-
import org.springframework.data.mongodb.core.convert.DefaultDbRefResolver;
2925
import org.springframework.data.mongodb.core.convert.MappingMongoConverter;
3026
import org.springframework.data.mongodb.core.convert.NoOpDbRefResolver;
3127
import org.springframework.data.mongodb.core.convert.QueryMapper;

0 commit comments

Comments
 (0)