Skip to content

Commit fdcd27d

Browse files
committed
DATAMONGO-2138 - Refactor TypedCriteriaBuilder.type()
1 parent 8de15a5 commit fdcd27d

File tree

3 files changed

+123
-132
lines changed

3 files changed

+123
-132
lines changed

spring-data-mongodb/src/main/kotlin/org/springframework/data/mongodb/core/query/TypedCriteriaBuilder.kt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,15 @@ class TypedCriteriaBuilder {
174174
* See [MongoDB Query operator: $type](https://docs.mongodb.com/manual/reference/operator/query/type/)
175175
* @see Criteria.type
176176
*/
177-
infix fun KProperty<*>.type(t: Array<JsonSchemaObject.Type>) = addOperation { type(*t) }
177+
infix fun KProperty<*>.type(t: Collection<JsonSchemaObject.Type>) = addOperation { type(*t.toTypedArray()) }
178+
179+
/**
180+
* Creates a criterion using the $type operator.
181+
*
182+
* See [MongoDB Query operator: $type](https://docs.mongodb.com/manual/reference/operator/query/type/)
183+
* @see Criteria.type
184+
*/
185+
fun KProperty<*>.type(vararg t: JsonSchemaObject.Type) = addOperation { type(*t) }
178186

179187
/**
180188
* Creates a criterion using the $not meta operator which affects the clause directly following

spring-data-mongodb/src/test/kotlin/example/Book.kt

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)