size
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
class User(
val grades: List<Int>,
)
collection.find {
User::grades size 3
}
Content copied to clipboard