Spring Data MongoDB - Core

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, Thomas Darimont, Christoph Strobl

Optional Element Summary
 boolean count
          Returns whether the query defined should be executed as count projection.
 boolean delete
          Returns whether the query should delete matching documents.
 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

delete

public abstract boolean delete
Returns whether the query should delete matching documents.

Returns:
Since:
1.5
Default:
false

Spring Data MongoDB - Core

Copyright © 2011-2014-2014 Pivotal Software, Inc.. All Rights Reserved.