MongoDB request DSL • opensavvy.ktmongo.dsl.query • FilterQueryPredicate
FilterQueryPredicate¶
interface FilterQueryPredicate<T> : CompoundBsonNode, FieldDsl
DSL for MongoDB operators that are used as predicates in conditions in a context where the targeted field is already specified.
Example¶
- 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¶
- T
-
The type on which this predicate applies. For example, if the selected field is of type
String
, thenT
isString
.
Properties¶
context
¶
abstract val context:
The context used to generate this expression.
field
¶
Converts a Kotlin property into a Field
.
Functions¶
accept
¶
Adds a new node
as a child of this one.
acceptAll
¶
Adds any number of nodes
into this one.
bitsAllClear
¶
abstract fun bitsAllClear(mask: )
Matches documents where all bit positions present in mask
are clear (i.e., 0) in the current field.
abstract fun bitsAllClear(mask: ByteArray)
Matches documents where all bit positions present in mask
are clear (i.e., 0) in the current field.
bitsAllSet
¶
abstract fun bitsAllSet(mask: )
Matches documents where all bit positions present in mask
are set (i.e., 1) in the current field.
abstract fun bitsAllSet(mask: ByteArray)
Matches documents where all bit positions present in mask
are set (i.e., 1) in the current field.
bitsAnyClear
¶
abstract fun bitsAnyClear(mask: )
Matches documents where any bit position present in mask
is clear (i.e., 0) in the current field.
abstract fun bitsAnyClear(mask: ByteArray)
Matches documents where any bit position present in mask
is clear (i.e., 0) in the current field.
bitsAnySet
¶
abstract fun bitsAnySet(mask: )
Matches documents where any bit position present in mask
is set (i.e., 1) in the current field.
abstract fun bitsAnySet(mask: ByteArray)
Matches documents where any bit position present in mask
is set (i.e., 1) in the current field.
div
¶
Refers to child
as a nested field of the current field.
doesNotExist
¶
abstract fun doesNotExist()
Matches documents that do not contain the specified field. Documents where the field if null
are counted as existing.
eq
¶
Matches documents where the value of a field equals the value
.
eqNotNull
¶
Matches documents where the value of a field equals value
.
exists
¶
abstract fun exists()
Matches documents that contain the specified field, including values where the field value is null
.
freeze
¶
abstract override fun freeze()
Makes this expression immutable.
get
¶
Refers to a specific item in an array, by its index.
Refers to a specific item in a map, by its name.
gt
¶
Selects documents for which this field has a value strictly greater than value
.
gte
¶
Selects documents for which this field has a value greater or equal to value
.
gteNotNull
¶
open fun gteNotNull(value: T?)
Selects documents for which this field has a value greater or equal to value
.
gtNotNull
¶
Selects documents for which this field has a value strictly greater than value
.
hasType
¶
abstract fun hasType(type: )
Selects documents where the value of the field is an instance of the specified BSON type
.
isNotNull
¶
open fun isNotNull()
Selects documents for which the field is not null
.
isNotOneOf
¶
open fun isNotOneOf(vararg values: T)
Selects documents for which this field is not equal to any of the given values
.
abstract fun isNotOneOf(values: Collection<T>)
Selects documents for which this field is not equal to any of the given values
.
isNotUndefined
¶
open fun isNotUndefined()
Selects documents for which the field is not undefined
.
isNull
¶
open fun isNull()
Selects documents for which the field is null
.
isOneOf
¶
Selects documents for which this field is equal to one of the given values
.
abstract fun isOneOf(values: Collection<T>)
Selects documents for which this field is equal to one of the given values
.
isUndefined
¶
open fun isUndefined()
Selects documents for which the field is undefined
.
lt
¶
Selects documents for which this field has a value strictly lesser than value
.
lte
¶
Selects documents for which this field has a value lesser or equal to value
.
lteNotNull
¶
open fun lteNotNull(value: T?)
Selects documents for which this field has a value lesser or equal to value
.
ltNotNull
¶
Selects documents for which this field has a value strictly lesser than value
.
ne
¶
Matches documents where the value of a field does not equal the value
.
not
¶
abstract fun not(expression: FilterQueryPredicate<T>.() -> Unit)
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.
regex
¶
Matches documents where the field corresponds to a given regex expression.
simplify
¶
Returns a simplified (but equivalent) expression to the current expression.
toBson
¶
open fun toBson():
Writes the result of simplifying
to a new Bson.
toString
¶
JSON representation of this expression.
writeTo
¶
abstract fun writeTo(writer: )
Writes the result of simplifying
this expression into writer
.