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: spring-data-mongodb/src/main/kotlin/org/springframework/data/mongodb/core/query/TypedCriteriaExtensions.kt
+2-5
Original file line number
Diff line number
Diff line change
@@ -53,16 +53,13 @@ private fun typedCriteriaSample(mongoOperations: MongoOperations) {
53
53
// Chain with typedCriteria()
54
54
typedCriteria(
55
55
Book::author elemMatch
56
-
(Author::name isEqualTo "Herman Melville"),
56
+
(Author::name isEqualTo "Herman Melville"),
57
57
Book::price exists true
58
58
)
59
59
// $or, $nor, $and operators
60
60
typedCriteria(
61
61
Book::name isEqualTo "Moby-Dick",
62
-
orOperator(
63
-
Book::price lt 1200,
64
-
Book::price gt 240
65
-
)
62
+
(Book::price lt 1200) or (Book::price gt 240)
66
63
)
67
64
// Nested Properties (i.e. refer to "book.author")
Copy file name to clipboardExpand all lines: spring-data-mongodb/src/test/kotlin/org/springframework/data/mongodb/core/query/TypedCriteriaExtensionsTests.kt
+32
Original file line number
Diff line number
Diff line change
@@ -416,6 +416,38 @@ class TypedCriteriaExtensionsTests {
416
416
assertEqualCriteria(typed, classic)
417
417
}
418
418
419
+
@Test
420
+
fun`infix or & and typed criteria should equal classic criteria`() {
421
+
422
+
val typed = (Book::title isEqualTo "Moby-Dick") and ((Book::price lt 1200) or (Book::price gt 240))
0 commit comments