Browse Source

DATAMONGO-2464 - Fix code examples in reference documentation.

fixed repository miss "{" issue.

Original pull request: #816.
pull/832/head
LiangYong 6 years ago committed by Mark Paluch
parent
commit
f69ddb6c61
No known key found for this signature in database
GPG Key ID: 51A00FA751B91849
  1. 12
      src/main/asciidoc/reference/mongo-repositories.adoc

12
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 @@ -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<Person, String>
public interface PersonRepository extends MongoRepository<Person, String> {
// { 'location' : { '$near' : [point.x, point.y], '$maxDistance' : distance}}
List<Person> findByLocationNear(Point location, Distance distance);
@ -361,7 +361,7 @@ Spring Data MongoDb supports geo-near queries, as the following example shows: @@ -361,7 +361,7 @@ Spring Data MongoDb supports geo-near queries, as the following example shows:
[source,java]
----
public interface PersonRepository extends MongoRepository<Person, String>
public interface PersonRepository extends MongoRepository<Person, String> {
// {'geoNear' : 'location', 'near' : [x, y] }
GeoResults<Person> findByLocationNear(Point location);
@ -388,7 +388,7 @@ By adding the `org.springframework.data.mongodb.repository.Query` annotation to @@ -388,7 +388,7 @@ By adding the `org.springframework.data.mongodb.repository.Query` annotation to
[source,java]
----
public interface PersonRepository extends MongoRepository<Person, String>
public interface PersonRepository extends MongoRepository<Person, String> {
@Query("{ 'firstname' : ?0 }")
List<Person> findByThePersonsFirstname(String firstname);
@ -404,7 +404,7 @@ You can also use the filter property to restrict the set of properties that is m @@ -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<Person, String>
public interface PersonRepository extends MongoRepository<Person, String> {
@Query(value="{ 'firstname' : ?0 }", fields="{ 'firstname' : 1, 'lastname' : 1}")
List<Person> findByThePersonsFirstname(String firstname);
@ -455,7 +455,7 @@ to declare the predicate value for `lastname` (which is equivalent to the `?0` p @@ -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<Person, String>
public interface PersonRepository extends MongoRepository<Person, String> {
@Query("{'lastname': ?#{[0]} }")
List<Person> findByQueryWithExpression(String param0);
@ -467,7 +467,7 @@ used in conjunction with JSON reveal a side-effect, because Map-like declaration @@ -467,7 +467,7 @@ used in conjunction with JSON reveal a side-effect, because Map-like declaration
[source,java]
----
public interface PersonRepository extends MongoRepository<Person, String>
public interface PersonRepository extends MongoRepository<Person, String> {
@Query("{'id': ?#{ [0] ? {$exists :true} : [1] }}")
List<Person> findByQueryWithExpressionAndNestedObject(boolean param0, String param1);

Loading…
Cancel
Save