diff --git a/src/main/asciidoc/reference/mongo-repositories.adoc b/src/main/asciidoc/reference/mongo-repositories.adoc index ee90dac0b..19e1e519b 100644 --- a/src/main/asciidoc/reference/mongo-repositories.adoc +++ b/src/main/asciidoc/reference/mongo-repositories.adoc @@ -312,7 +312,7 @@ The following example shows how to define a `near` query that finds all persons ==== [source,java] ---- -public interface PersonRepository extends MongoRepository +public interface PersonRepository extends MongoRepository { // { 'location' : { '$near' : [point.x, point.y], '$maxDistance' : distance}} List findByLocationNear(Point location, Distance distance); @@ -345,7 +345,7 @@ Spring Data MongoDb supports geo-near queries, as the following example shows: [source,java] ---- -public interface PersonRepository extends MongoRepository +public interface PersonRepository extends MongoRepository { // {'geoNear' : 'location', 'near' : [x, y] } GeoResults findByLocationNear(Point location); @@ -372,7 +372,7 @@ By adding the `org.springframework.data.mongodb.repository.Query` annotation to [source,java] ---- -public interface PersonRepository extends MongoRepository +public interface PersonRepository extends MongoRepository { @Query("{ 'firstname' : ?0 }") List findByThePersonsFirstname(String firstname); @@ -388,7 +388,7 @@ You can also use the filter property to restrict the set of properties that is m [source,java] ---- -public interface PersonRepository extends MongoRepository +public interface PersonRepository extends MongoRepository { @Query(value="{ 'firstname' : ?0 }", fields="{ 'firstname' : 1, 'lastname' : 1}") List findByThePersonsFirstname(String firstname); @@ -439,7 +439,7 @@ to declare the predicate value for `lastname` (which is equivalent to the `?0` p [source,java] ---- -public interface PersonRepository extends MongoRepository +public interface PersonRepository extends MongoRepository { @Query("{'lastname': ?#{[0]} }") List findByQueryWithExpression(String param0); @@ -451,7 +451,7 @@ used in conjunction with JSON reveal a side-effect, because Map-like declaration [source,java] ---- -public interface PersonRepository extends MongoRepository +public interface PersonRepository extends MongoRepository { @Query("{'id': ?#{ [0] ? {$exists :true} : [1] }}") List findByQueryWithExpressionAndNestedObject(boolean param0, String param1);