DATAMONGO-2264 - Polishing.
Store result to getPersistentEntity() in local variable to reduce invocation count. Use numbered postfix instead of object instantiation to generate a unique distance field name. Deprecate geoNear methods with hint to aggregations. Fix distance field usage in ReactiveMongoTemplate. Tweak docs. Original pull request: #744.
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
|
||||
[[new-features.2-2-0]]
|
||||
== What's New in Spring Data MongoDB 2.2
|
||||
* Compatible with MongoDB 4.2.
|
||||
* Compatibility with MongoDB 4.2 deprecating `eval`, `group` and `geoNear` Template API methods.
|
||||
* <<mongo.query.kotlin-support,Type-safe Queries for Kotlin>>
|
||||
* <<mongodb.reactive.repositories.queries.type-safe,Querydsl support for reactive repositories>> via `ReactiveQuerydslPredicateExecutor`.
|
||||
* <<reactive.gridfs,Reactive GridFS support>>.
|
||||
|
||||
@@ -1343,16 +1343,16 @@ Spring Data MongoDB 2.2 `MongoOperations#geoNear` uses the `$geoNear` https://do
|
||||
instead of the `geoNear` command to run a `NearQuery`.
|
||||
|
||||
The calculated distance (the `dis` when using a geoNear command) previously returned within a wrapper type now is embedded
|
||||
into the resulting document. If the given domain type already contains a property with equal name, the calculated distance
|
||||
is named `calculated-distance` or if that name is taken as well, postfixed with a random hash.
|
||||
into the resulting document.
|
||||
If the given domain type already contains a property with that name, the calculated distance
|
||||
is named `calculated-distance` with a potentially random postfix.
|
||||
|
||||
Target types may contain a property named after the returned distance to (additionally) read it back directly into the domain
|
||||
type as shown below.
|
||||
Target types may contain a property named after the returned distance to (additionally) read it back directly into the domain type as shown below.
|
||||
|
||||
[source,java]
|
||||
----
|
||||
GeoResults<VenueWithDisField> = template.query(Venue.class) <1>
|
||||
.as(VenueWithDisField.class) <2>
|
||||
.as(VenueWithDisField.class) <2>
|
||||
.near(NearQuery.near(new GeoJsonPoint(-73.99, 40.73), KILOMETERS))
|
||||
.all();
|
||||
----
|
||||
|
||||
Reference in New Issue
Block a user