MongoDB request DSL • opensavvy.ktmongo.dsl.aggregation.operators • ArrayValueOperators • filter
filter¶
Selects a subset of an array to return based on the specified predicate, similarly to kotlin.collections.filter.
The returned elements are in the original order.
Example¶
class Sensor(
val measurements: List<Int>,
)
collection.updateManyWithPipeline {
set {
Sensor::measurements set (Sensor::measurements).filter { it gte of(0) }
}
}
External resources¶
Parameters¶
- limit
-
If set, specifies a maximum number of elements returned: only the first
limitmatching elements are returned, even if there are more matching elements. Must be greater or equal to1, or benull. - variableName
-
The name of the temporary variable passed to the
predicatelambda, which represents the current element being iterated over. By default,"this". Setting this parameter is only useful when using nestedfilteror other similar calls, which could otherwise conflict.
Selects a subset of an array to return based on the specified predicate, similarly to kotlin.collections.filter.
The returned elements are in the original order.
Example¶
class Sensor(
val measurements: List<Int>,
)
collection.updateManyWithPipeline {
set {
Sensor::measurements set (Sensor::measurements).filter { it gte of(0) }
}
}
External resources¶
Parameters¶
- limit
-
If set, specifies a maximum number of elements returned: only the first
limitmatching elements are returned, even if there are more matching elements. Must be greater or equal to1, or benull. - variableName
-
The name of the temporary variable passed to the
predicatelambda, which represents the current element being iterated over. By default,"this". Setting this parameter is only useful when using nestedfilteror other similar calls, which could otherwise conflict.
Selects a subset of an array to return based on the specified predicate, similarly to kotlin.collections.filter.
The returned elements are in the original order.
Example¶
class Sensor(
val measurements: List<Int>,
)
collection.updateManyWithPipeline {
set {
Sensor::measurements set (Sensor::measurements).filter { it gte of(0) }
}
}
External resources¶
Parameters¶
- limit
-
If set, specifies a maximum number of elements returned: only the first
limitmatching elements are returned, even if there are more matching elements. Must be greater or equal to1, or benull. - variableName
-
The name of the temporary variable passed to the
predicatelambda, which represents the current element being iterated over. By default,"this". Setting this parameter is only useful when using nestedfilteror other similar calls, which could otherwise conflict.
Selects a subset of an array to return based on the specified predicate, similarly to kotlin.collections.filter.
The returned elements are in the original order.
Example¶
class Sensor(
val measurements: List<Int>,
)
collection.updateManyWithPipeline {
set {
Sensor::measurements set (Sensor::measurements).filter { it gte of(0) }
}
}
External resources¶
Parameters¶
- limit
-
If set, specifies a maximum number of elements returned: only the first
limitmatching elements are returned, even if there are more matching elements. Must be greater or equal to1, or benull. - variableName
-
The name of the temporary variable passed to the
predicatelambda, which represents the current element being iterated over. By default,"this". Setting this parameter is only useful when using nestedfilteror other similar calls, which could otherwise conflict.