FilterQueryPredicate
DSL for MongoDB operators that are used as predicates in conditions in a context where the targeted field is already specified.
Example
class User(
val name: String?,
val age: Int,
)
collection.find {
User::name { //(1)
eq("foo")
}
}
By referring to a specific property, we obtain a FilterQueryPredicate that we can use to declare many operators on that property.
If you can't find the operator you're searching for, visit the tracking issue.
External resources
Parameters
The type on which this predicate applies. For example, if the selected field is of type String
, then T
is String
.
Properties
Functions
Matches documents where all bit positions present in mask are clear (i.e., 0) in the current field.
Matches documents where all bit positions present in mask are set (i.e., 1) in the current field.
Matches documents where any bit position present in mask is clear (i.e., 0) in the current field.
Matches documents where any bit position present in mask is set (i.e., 1) in the current field.
Matches documents that do not contain the specified field. Documents where the field if null
are counted as existing.
Refers to a specific item in an array, by its index.
Refers to a specific item in a map, by its name.
Selects documents for which this field has a value greater or equal to value.
Selects documents for which this field is not equal to any of the given values.
Selects documents for which the field is not undefined
.
Selects documents for which the field is undefined
.
Selects documents for which this field has a value lesser or equal to value.
Performs a logical NOT
operation on the specified expression and selects the documents that do not match the expression. This includes the elements that do not contain the field.
Writes the result of simplifying to a new Bson.
Writes the result of simplifying this expression into writer.