You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/main/asciidoc/reference/query-by-example.adoc
+4-2Lines changed: 4 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
[[query.by.example.execution]]
2
-
== Executing Query by Example
2
+
===Executing Example
3
3
4
4
In Spring Data MongoDB you can use Query by Example with the `MongoTemplate` and with Repositories.
5
5
@@ -17,7 +17,7 @@ public class PersonService {
17
17
----
18
18
====
19
19
20
-
`MongoTemplate.findByExample` accepts either the probe or an `Example` object to create and execute a query.
20
+
`MongoTemplate.findByExample` accepts either the probe or an `Example` object to create and execute a query. An `Example` containing an untyped `ExampleSpec` uses the probe type to determine the collection name and the result type. Typed `ExampleSpec` use their type to determine collection name and result type.
21
21
22
22
23
23
.Query by Example using a Repository
@@ -39,6 +39,8 @@ public class PersonService {
39
39
----
40
40
====
41
41
42
+
An `Example` containing an untyped `ExampleSpec` uses the Repository type and its collection name. Typed `ExampleSpec` use their type as result type and the collection name from the Repository.
43
+
42
44
NOTE: When including `null` values in the `ExampleSpec` Spring Data Mongo uses embedded document matching instead of dot notation property matching. This forces exact document matching for all property values and the property order in the embedded document.
43
45
44
46
Spring Data MongoDB provides support for the following matching options:
0 commit comments