Browse Source

Document usage scope and effects of Meta annotation.

Original pull request #4854
See #4852
issue/aot-doc
Mark Paluch 1 year ago committed by Jens Schauder
parent
commit
a9e5f96b6c
No known key found for this signature in database
GPG Key ID: 2BE5D185CD2A1CE6
  1. 6
      spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/Meta.java
  2. 4
      spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/Near.java
  3. 5
      src/main/antora/modules/ROOT/pages/mongodb/repositories/query-methods.adoc

6
spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/Meta.java

@ -24,6 +24,12 @@ import java.lang.annotation.Target;
import org.springframework.data.annotation.QueryAnnotation; import org.springframework.data.annotation.QueryAnnotation;
/** /**
* Annotation to declare meta-information (execution time, cursor size, disk usage) for query methods.
* <p>
* Annotating a repository method with this annotation forces the method to be implemented as query method (i.e. using
* this annotation on an overridden method from a base interface or fragment interface), similar to using
* {@link Query @Query}.
*
* @author Christoph Strobl * @author Christoph Strobl
* @author Mark Paluch * @author Mark Paluch
* @since 1.6 * @since 1.6

4
spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/Near.java

@ -25,8 +25,8 @@ import org.springframework.data.geo.Distance;
import org.springframework.data.geo.Point; import org.springframework.data.geo.Point;
/** /**
* Annotation to be used for disambiguing method parameters that shall be used to trigger geo near queries. By default * Annotation to be used for disambiguating method parameters that shall be used to trigger geo near queries. By
* those parameters are found without the need for additional annotation if they are the only parameters of the * default, those parameters are found without the need for additional annotation if they are the only parameters of the
* according type (e.g. {@link Point}, {@code double[]}, {@link Distance}). * according type (e.g. {@link Point}, {@code double[]}, {@link Distance}).
* *
* @author Oliver Gierke * @author Oliver Gierke

5
src/main/antora/modules/ROOT/pages/mongodb/repositories/query-methods.adoc

@ -205,6 +205,9 @@ lower / upper bounds (`$gt` / `$gte` & `$lt` / `$lte`) according to `Range`
NOTE: If the property criterion compares a document, the order of the fields and exact equality in the document matters. NOTE: If the property criterion compares a document, the order of the fields and exact equality in the document matters.
NOTE: In some scenarios, you might require additional options, such as a maximum run time, additional log comments, or the permission to temporarily write data to disk.
Use the `@Meta` annotation to set those options via `maxExecutionTimeMs`, `comment` or `allowDiskUse`. `@Meta` can only be used on repository query methods, not on base interface or fragment interface methods.
[[mongodb.repositories.queries.geo-spatial]] [[mongodb.repositories.queries.geo-spatial]]
== Geo-spatial Queries == Geo-spatial Queries
@ -443,7 +446,7 @@ public interface PersonRepository extends ReactiveMongoRepository<Person, String
====== ======
Expressions can be used to invoke functions, evaluate conditionals, and construct values. Expressions can be used to invoke functions, evaluate conditionals, and construct values.
SpEL expressions used in conjunction with JSON reveal a side-effect, because Map-like declarations inside of SpEL read like JSON, as the following example shows: SpEL expressions used in conjunction with JSON reveal a side effect, because Map-like declarations inside of SpEL read like JSON, as the following example shows:
[tabs] [tabs]
====== ======

Loading…
Cancel
Save