diff --git a/src/main/asciidoc/reference/mongo-repositories.adoc b/src/main/asciidoc/reference/mongo-repositories.adoc index 04715cb29..f1fc60af1 100644 --- a/src/main/asciidoc/reference/mongo-repositories.adoc +++ b/src/main/asciidoc/reference/mongo-repositories.adoc @@ -328,7 +328,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); @@ -361,7 +361,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); @@ -388,7 +388,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); @@ -404,7 +404,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); @@ -455,7 +455,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); @@ -467,7 +467,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);