MongoDB request DSL • opensavvy.ktmongo.dsl.query • FilterQuery • size
size¶
abstract infix fun Field<T, Collection<*>>.size(size: Int)
Selects documents where the value of a field is an array of size size
(exactly).
This operator cannot accept a range of values. To select documents based on fields with different numbers of elements, create a counter field that you increment when you add elements to a field.
Queries cannot use indexes for this portion of the query, but other parts of the query may use indexes if applicable.
Example¶
External resources¶
open infix fun KProperty1<T, Collection<*>>.size(size: Int)
Selects documents where the value of a field is an array of size size
(exactly).
This operator cannot accept a range of values. To select documents based on fields with different numbers of elements, create a counter field that you increment when you add elements to a field.
Queries cannot use indexes for this portion of the query, but other parts of the query may use indexes if applicable.