kmongo / org.litote.kmongo / kotlin.reflect.KProperty / elemMatchProj

elemMatchProj

fun <T> KProperty<T>.elemMatchProj(): Bson (source)

Creates a projection that includes for the given property only the first element of an array that matches the query filter. This is referred to as the positional $ operator.

Return
the projection

Mongodb
.driver.manual reference/operator/projection/positional/#projection Project the first matching element ($ operator)

fun <T> KProperty<T>.elemMatchProj(filter: Bson): Bson (source)

Creates a projection that includes for the given property only the first element of the array value of that field that matches the given query filter.

Parameters

filter - the filter to apply

Return
the projection

Mongodb
.driver.manual reference/operator/projection/elemMatch elemMatch