@Retention(value=RUNTIME) @Target(value={METHOD,ANNOTATION_TYPE}) @Documented public @interface Query
?0, ?1 and so on.| Modifier and Type | Optional Element and Description |
|---|---|
String |
collation
Defines the collation to apply when executing the query.
|
boolean |
count
Returns whether the query defined should be executed as count projection.
|
boolean |
delete
Returns whether the query should delete matching documents.
|
boolean |
exists
Returns whether the query defined should be executed as exists projection.
|
String |
fields
Defines the fields that should be returned for the given query.
|
String |
sort
Defines a default sort order for the given query.
|
String |
value
Takes a MongoDB JSON string to define the actual query to be executed.
|
public abstract boolean count
public abstract boolean exists
public abstract boolean delete
public abstract String sort
Sort argument of the query method.
@Query(sort = "{ age : -1 }") // order by age descending
List<Person> findByFirstname(String firstname);
String by default.public abstract String collation
// Fixed value
@Query(collation = "en_US")
List<Entry> findAllByFixedCollation();
// Fixed value as Document
@Query(collation = "{ 'locale' : 'en_US' }")
List<Entry> findAllByFixedJsonCollation();
// Dynamic value as String
@Query(collation = "?0")
List<Entry> findAllByDynamicCollation(String collation);
// Dynamic value as Document
@Query(collation = "{ 'locale' : ?0 }")
List<Entry> findAllByDynamicJsonCollation(String collation);
// SpEL expression
@Query(collation = "?#{[0]}")
List<Entry> findAllByDynamicSpElCollation(String collation);
String by default.Copyright © 2011–2023 Pivotal Software, Inc.. All rights reserved.