Spring Data MongoDB

org.springframework.data.mongodb.repository
Annotation Type Query


@Retention(value=RUNTIME)
@Target(value=METHOD)
@Documented
public @interface Query

Annotation to declare finder queries directly on repository methods. Both attributes allow using a placeholder notation of ?0, ?1 and so on.

Author:
Oliver Gierke

Optional Element Summary
 boolean count
          Returns whether the query defined should be executed as count projection.
 String fields
          Defines the fields that should be returned for the given query.
 String value
          Takes a MongoDB JSON string to define the actual query to be executed.
 

value

public abstract String value
Takes a MongoDB JSON string to define the actual query to be executed. This one will take precendece over the method name then.

Returns:
Default:
""

fields

public abstract String fields
Defines the fields that should be returned for the given query. Note that only these fields will make it into the domain object returned.

Returns:
Default:
""

count

public abstract boolean count
Returns whether the query defined should be executed as count projection.

Returns:
Since:
1.3
Default:
false

Spring Data MongoDB

Copyright © 2011-2013-2013 Pivotal. All Rights Reserved.