expr
Enables the usage of aggregation values within a regular query.
Aggregation values are much more powerful than regular query operators (for example, it is possible to compare two fields of the same document). However, the way they are written is quite different, and the way they are evaluated by MongoDB is quite different again. Before using aggregation values, be sure to read AggregationOperators.
Example
class Product(
val name: String,
val creationDate: Instant,
val releaseDate: Instant,
)
val anomalies = products.find {
expr {
of(Product::creationDate) gt of(Product::releaseDate)
}
}
Content copied to clipboard