public class FiltersKt
@NotNull
public static <T> org.bson.conversions.Bson eq(@NotNull
kotlin.reflect.KProperty<? extends T> $this$eq,
@Nullable
T value)
Creates a filter that matches all documents where the value of the property equals the specified value. Note that this doesn't actually generate a $eq operator, as the query language doesn't require it.
value - the value@NotNull
public static <T> org.bson.conversions.Bson contains(@NotNull
kotlin.reflect.KProperty<? extends java.lang.Iterable<? extends T>> $this$contains,
@Nullable
T value)
Creates a filter that matches all documents where the value of the property contains the specified value. Note that this doesn't actually generate a $eq operator, as the query language doesn't require it.
Please be aware that although can be any object, using this method to find documents matching complex object is extremely fragile. In particular, MongoDB only consider two documents equal if they have the same set of key/value pairs, in the same order.
The elemMatch method is a much better alternative for complex object values.
value - the value@NotNull
public static <T> org.bson.conversions.Bson ne(@NotNull
kotlin.reflect.KProperty<? extends T> $this$ne,
@Nullable
T value)
Creates a filter that matches all documents where the value of the field name does not equal the specified value.
value - the value@NotNull
public static <T> org.bson.conversions.Bson lt(@NotNull
kotlin.reflect.KProperty<? extends T> $this$lt,
T item)
Creates a filter that matches all documents where the value of the given property is less than the specified value.
@NotNull
public static <T> org.bson.conversions.Bson gt(@NotNull
kotlin.reflect.KProperty<? extends T> $this$gt,
T value)
Creates a filter that matches all documents where the value of the given property is greater than the specified value.
value - the value@NotNull
public static <T> org.bson.conversions.Bson lte(@NotNull
kotlin.reflect.KProperty<? extends T> $this$lte,
T value)
Creates a filter that matches all documents where the value of the given property is less than or equal to the specified value.
value - the value@NotNull
public static <T> org.bson.conversions.Bson gte(@NotNull
kotlin.reflect.KProperty<? extends T> $this$gte,
T value)
Creates a filter that matches all documents where the value of the given property is greater than or equal to the specified value.
value - the value@NotNull
public static <T> org.bson.conversions.Bson in(@NotNull
kotlin.reflect.KProperty<? extends T> $this$in,
@NotNull
java.lang.Iterable<? extends T> values)
Creates a filter that matches all documents where the value of a property equals any value in the list of specified values.
values - the list of values@NotNull
public static <T> org.bson.conversions.Bson in(@NotNull
kotlin.reflect.KProperty<? extends T> $this$in,
@NotNull
java.lang.String expression)
Creates a filter that matches all documents where the value of a property equals any value in the list of specified values.
@JvmName
@NotNull
public static <T> org.bson.conversions.Bson inArray(@NotNull
kotlin.reflect.KProperty<? extends java.lang.Iterable<? extends T>> $this$in,
@NotNull
java.lang.Iterable<? extends T> values)
Creates a filter that matches all documents where the value of a property equals any value in the list of specified values.
values - the list of values@NotNull
public static <T> org.bson.conversions.Bson nin(@NotNull
kotlin.reflect.KProperty<? extends T> $this$nin,
@NotNull
java.lang.Iterable<? extends T> values)
Creates a filter that matches all documents where the value of a property does not equal any of the specified values or does not exist.
values - the list of values@JvmName
@NotNull
public static <T> org.bson.conversions.Bson ninArray(@NotNull
kotlin.reflect.KProperty<? extends java.lang.Iterable<? extends T>> $this$nin,
@NotNull
java.lang.Iterable<? extends T> values)
Creates a filter that matches all documents where the value of a property does not equal any of the specified values or does not exist.
values - the list of values@NotNull
public static org.bson.conversions.Bson and(@NotNull
java.lang.Iterable<? extends org.bson.conversions.Bson> filters)
Creates a filter that performs a logical AND of the provided list of filters. Note that this will only generate a "$and" operator if absolutely necessary, as the query language implicity ands together all the keys. In other words, a query expression like:
will generate a MongoDB query like:
filters - the list of filters to and together@NotNull
public static org.bson.conversions.Bson and(@NotNull
org.bson.conversions.Bson... filters)
Creates a filter that performs a logical AND of the provided list of filters. Note that this will only generate a "$and" operator if absolutely necessary, as the query language implicity ands together all the keys. In other words, a query expression like:
will generate a MongoDB query like:
filters - the list of filters to and together@NotNull
public static org.bson.conversions.Bson or(@NotNull
java.lang.Iterable<? extends org.bson.conversions.Bson> filters)
Creates a filter that preforms a logical OR of the provided list of filters.
filters - the list of filters to and together@NotNull
public static org.bson.conversions.Bson or(@NotNull
org.bson.conversions.Bson... filters)
Creates a filter that preforms a logical OR of the provided list of filters.
filters - the list of filters to and together@NotNull
public static org.bson.conversions.Bson not(@NotNull
org.bson.conversions.Bson filter)
Creates a filter that matches all documents that do not match the passed in filter. Requires the field name to passed as part of the value passed in and lifts it to create a valid "$not" query:
will generate a MongoDB query like:
filter - the value@NotNull
public static org.bson.conversions.Bson nor(@NotNull
org.bson.conversions.Bson... filters)
Creates a filter that performs a logical NOR operation on all the specified filters.
filters - the list of values@NotNull
public static org.bson.conversions.Bson nor(@NotNull
java.lang.Iterable<? extends org.bson.conversions.Bson> filters)
Creates a filter that performs a logical NOR operation on all the specified filters.
filters - the list of values@NotNull
public static <T> org.bson.conversions.Bson exists(@NotNull
kotlin.reflect.KProperty<? extends T> $this$exists)
Creates a filter that matches all documents that contain the given property.
@NotNull
public static <T> org.bson.conversions.Bson exists(@NotNull
kotlin.reflect.KProperty<? extends T> $this$exists,
boolean exists)
Creates a filter that matches all documents that either contain or do not contain the given property, depending on the value of the exists parameter.
exists - true to check for existence, false to check for absence@NotNull
public static <T> org.bson.conversions.Bson type(@NotNull
kotlin.reflect.KProperty<? extends T> $this$type,
@NotNull
org.bson.BsonType type)
Creates a filter that matches all documents where the value of the property is of the specified BSON type.
type - the BSON type@NotNull
public static <T> org.bson.conversions.Bson mod(@NotNull
kotlin.reflect.KProperty<? extends T> $this$mod,
long divisor,
long remainder)
Creates a filter that matches all documents where the value of a property divided by a divisor has the specified remainder (i.e. perform a modulo operation to select documents).
divisor - the modulusremainder - the remainder@NotNull
public static org.bson.conversions.Bson regex(@NotNull
kotlin.reflect.KProperty<java.lang.String> $this$regex,
@NotNull
java.lang.String regex)
Creates a filter that matches all documents where the value of the property matches the given regular expression pattern.
@NotNull
public static org.bson.conversions.Bson regex(@NotNull
kotlin.reflect.KProperty<java.lang.String> $this$regex,
@NotNull
java.util.regex.Pattern regex)
Creates a filter that matches all documents where the value of the property matches the given regular expression pattern.
@NotNull
public static org.bson.conversions.Bson regex(@NotNull
kotlin.reflect.KProperty<java.lang.String> $this$regex,
@NotNull
java.lang.String pattern,
@NotNull
java.lang.String options)
Creates a filter that matches all documents where the value of the option matches the given regular expression pattern with the given options applied.
pattern - the patternoptions - the options@NotNull
public static org.bson.conversions.Bson regex(@NotNull
kotlin.reflect.KProperty<java.lang.String> $this$regex,
@NotNull
kotlin.text.Regex regex)
Creates a filter that matches all documents where the value of the property matches the given regular expression pattern.
regex - the regex@JvmName
@NotNull
public static org.bson.conversions.Bson regexIterable(@NotNull
kotlin.reflect.KProperty<? extends java.lang.Iterable<java.lang.String>> $this$regex,
@NotNull
java.lang.String regex)
Creates a filter that matches all documents where the value of the property matches the given regular expression pattern.
@JvmName
@NotNull
public static org.bson.conversions.Bson regexIterable(@NotNull
kotlin.reflect.KProperty<? extends java.lang.Iterable<java.lang.String>> $this$regex,
@NotNull
java.util.regex.Pattern regex)
Creates a filter that matches all documents where the value of the property matches the given regular expression pattern.
@JvmName
@NotNull
public static org.bson.conversions.Bson regexIterable(@NotNull
kotlin.reflect.KProperty<? extends java.lang.Iterable<java.lang.String>> $this$regex,
@NotNull
java.lang.String pattern,
@NotNull
java.lang.String options)
Creates a filter that matches all documents where the value of the option matches the given regular expression pattern with the given options applied.
pattern - the patternoptions - the options@JvmName
@NotNull
public static org.bson.conversions.Bson regexIterable(@NotNull
kotlin.reflect.KProperty<? extends java.lang.Iterable<java.lang.String>> $this$regex,
@NotNull
kotlin.text.Regex regex)
Creates a filter that matches all documents where the value of the property matches the given regular expression pattern.
regex - the regex@NotNull
public static org.bson.conversions.Bson text(@NotNull
java.lang.String search,
@NotNull
com.mongodb.client.model.TextSearchOptions textSearchOptions)
Creates a filter that matches all documents matching the given the search term with the given text search options.
search - the search termtextSearchOptions - the text search options to use@NotNull
public static org.bson.conversions.Bson where(@NotNull
java.lang.String javaScriptExpression)
Creates a filter that matches all documents for which the given expression is true.
javaScriptExpression - the JavaScript expression@NotNull public static <TExpression> org.bson.conversions.Bson expr(TExpression expression)
Creates a filter that matches all documents that validate against the given JSON schema document.
expression - the aggregation expression@NotNull
public static <T> org.bson.conversions.Bson all(@NotNull
kotlin.reflect.KProperty<? extends java.lang.Iterable<? extends T>> $this$all,
@NotNull
java.lang.Iterable<? extends T> values)
Creates a filter that matches all documents where the value of a property is an array that contains all the specified values.
values - the list of values@NotNull
public static <T> org.bson.conversions.Bson all(@NotNull
kotlin.reflect.KProperty<? extends java.lang.Iterable<? extends T>> $this$all,
@NotNull
T... values)
Creates a filter that matches all documents where the value of a property is an array that contains all the specified values.
values - the list of values@NotNull
public static <T> org.bson.conversions.Bson elemMatch(@NotNull
kotlin.reflect.KProperty<? extends java.lang.Iterable<? extends T>> $this$elemMatch,
@NotNull
org.bson.conversions.Bson filter)
Creates a filter that matches all documents containing a property that is an array where at least one member of the array matches the given filter.
filter - the filter to apply to each element@NotNull
public static <T> org.bson.conversions.Bson size(@NotNull
kotlin.reflect.KProperty<? extends T> $this$size,
int size)
Creates a filter that matches all documents where the value of a property is an array of the specified size.
size - the size of the array@NotNull
public static <T> org.bson.conversions.Bson bitsAllClear(@NotNull
kotlin.reflect.KProperty<? extends T> $this$bitsAllClear,
long bitmask)
Creates a filter that matches all documents where all of the bit positions are clear in the property.
bitmask - the bitmask@NotNull
public static <T> org.bson.conversions.Bson bitsAllSet(@NotNull
kotlin.reflect.KProperty<? extends T> $this$bitsAllSet,
long bitmask)
Creates a filter that matches all documents where all of the bit positions are set in the property.
bitmask - the bitmask@NotNull
public static <T> org.bson.conversions.Bson bitsAnyClear(@NotNull
kotlin.reflect.KProperty<? extends T> $this$bitsAnyClear,
long bitmask)
Creates a filter that matches all documents where any of the bit positions are clear in the property.
bitmask - the bitmask@NotNull
public static <T> org.bson.conversions.Bson bitsAnySet(@NotNull
kotlin.reflect.KProperty<? extends T> $this$bitsAnySet,
long bitmask)
Creates a filter that matches all documents where any of the bit positions are set in the property.
bitmask - the bitmask@NotNull
public static <T> org.bson.conversions.Bson geoWithin(@NotNull
kotlin.reflect.KProperty<? extends T> $this$geoWithin,
@NotNull
com.mongodb.client.model.geojson.Geometry geometry)
Creates a filter that matches all documents containing a property with geospatial data that exists entirely within the specified shape.
geometry - the bounding GeoJSON geometry object@NotNull
public static <T> org.bson.conversions.Bson geoWithin(@NotNull
kotlin.reflect.KProperty<? extends T> $this$geoWithin,
@NotNull
org.bson.conversions.Bson geometry)
Creates a filter that matches all documents containing a property with geospatial data that exists entirely within the specified shape.
geometry - the bounding GeoJSON geometry object@NotNull
public static <T> org.bson.conversions.Bson geoWithinBox(@NotNull
kotlin.reflect.KProperty<? extends T> $this$geoWithinBox,
double lowerLeftX,
double lowerLeftY,
double upperRightX,
double upperRightY)
Creates a filter that matches all documents containing a property with grid coordinates data that exist entirely within the specified box.
lowerLeftX - the lower left x coordinate of the boxlowerLeftY - the lower left y coordinate of the boxupperRightX - the upper left x coordinate of the boxupperRightY - the upper left y coordinate of the box@NotNull
public static <T> org.bson.conversions.Bson geoWithinPolygon(@NotNull
kotlin.reflect.KProperty<? extends T> $this$geoWithinPolygon,
@NotNull
java.util.List<? extends java.util.List<java.lang.Double>> points)
Creates a filter that matches all documents containing a property with grid coordinates data that exist entirely within the specified polygon.
points - a list of pairs of x, y coordinates. Any extra dimensions are ignored@NotNull
public static <T> org.bson.conversions.Bson geoWithinCenter(@NotNull
kotlin.reflect.KProperty<? extends T> $this$geoWithinCenter,
double x,
double y,
double radius)
Creates a filter that matches all documents containing a property with grid coordinates data that exist entirely within the specified circle.
x - the x coordinate of the circley - the y coordinate of the circleradius - the radius of the circle, as measured in the units used by the coordinate system@NotNull
public static <T> org.bson.conversions.Bson geoWithinCenterSphere(@NotNull
kotlin.reflect.KProperty<? extends T> $this$geoWithinCenterSphere,
double x,
double y,
double radius)
Creates a filter that matches all documents containing a property with geospatial data (GeoJSON or legacy coordinate pairs) that exist entirely within the specified circle, using spherical geometry. If using longitude and latitude, specify longitude first.
x - the x coordinate of the circley - the y coordinate of the circleradius - the radius of the circle, in radians@NotNull
public static <T> org.bson.conversions.Bson geoIntersects(@NotNull
kotlin.reflect.KProperty<? extends T> $this$geoIntersects,
@NotNull
com.mongodb.client.model.geojson.Geometry geometry)
Creates a filter that matches all documents containing a property with geospatial data that intersects with the specified shape.
geometry - the bounding GeoJSON geometry object@NotNull
public static <T> org.bson.conversions.Bson geoIntersects(@NotNull
kotlin.reflect.KProperty<? extends T> $this$geoIntersects,
@NotNull
org.bson.conversions.Bson geometry)
Creates a filter that matches all documents containing a property with geospatial data that intersects with the specified shape.
geometry - the bounding GeoJSON geometry object@NotNull
public static <T> org.bson.conversions.Bson near(@NotNull
kotlin.reflect.KProperty<? extends T> $this$near,
@NotNull
com.mongodb.client.model.geojson.Point geometry,
@Nullable
java.lang.Double maxDistance,
@Nullable
java.lang.Double minDistance)
Creates a filter that matches all documents containing a property with geospatial data that is near the specified GeoJSON point.
geometry - the bounding GeoJSON geometry objectmaxDistance - the maximum distance from the point, in metersminDistance - the minimum distance from the point, in meters@NotNull
public static <T> org.bson.conversions.Bson near(@NotNull
kotlin.reflect.KProperty<? extends T> $this$near,
@NotNull
org.bson.conversions.Bson geometry,
@Nullable
java.lang.Double maxDistance,
@Nullable
java.lang.Double minDistance)
Creates a filter that matches all documents containing a property with geospatial data that is near the specified GeoJSON point.
geometry - the bounding GeoJSON geometry objectmaxDistance - the maximum distance from the point, in metersminDistance - the minimum distance from the point, in meters@NotNull
public static <T> org.bson.conversions.Bson near(@NotNull
kotlin.reflect.KProperty<? extends T> $this$near,
double x,
double y,
@Nullable
java.lang.Double maxDistance,
@Nullable
java.lang.Double minDistance)
Creates a filter that matches all documents containing a property with geospatial data that is near the specified point.
x - the x coordinatey - the y coordinatemaxDistance - the maximum distance from the point, in radiansminDistance - the minimum distance from the point, in radians@NotNull
public static <T> org.bson.conversions.Bson nearSphere(@NotNull
kotlin.reflect.KProperty<? extends T> $this$nearSphere,
@NotNull
org.bson.conversions.Bson geometry,
@Nullable
java.lang.Double maxDistance,
@Nullable
java.lang.Double minDistance)
Creates a filter that matches all documents containing a property with geospatial data that is near the specified GeoJSON point using spherical geometry.
geometry - the bounding GeoJSON geometry objectmaxDistance - the maximum distance from the point, in metersminDistance - the minimum distance from the point, in meters@NotNull
public static <T> org.bson.conversions.Bson nearSphere(@NotNull
kotlin.reflect.KProperty<? extends T> $this$nearSphere,
@NotNull
com.mongodb.client.model.geojson.Point geometry,
@Nullable
java.lang.Double maxDistance,
@Nullable
java.lang.Double minDistance)
Creates a filter that matches all documents containing a property with geospatial data that is near the specified GeoJSON point using spherical geometry.
geometry - the bounding GeoJSON geometry objectmaxDistance - the maximum distance from the point, in metersminDistance - the minimum distance from the point, in meters@NotNull
public static <T> org.bson.conversions.Bson nearSphere(@NotNull
kotlin.reflect.KProperty<? extends T> $this$nearSphere,
double x,
double y,
@Nullable
java.lang.Double maxDistance,
@Nullable
java.lang.Double minDistance)
Creates a filter that matches all documents containing a property with geospatial data that is near the specified point using spherical geometry.
x - the x coordinatey - the y coordinatemaxDistance - the maximum distance from the point, in radiansminDistance - the minimum distance from the point, in radians@NotNull
public static org.bson.conversions.Bson jsonSchema(@NotNull
org.bson.conversions.Bson schema)
Creates a filter that matches all documents that validate against the given JSON schema document.
schema - the JSON schema to validate against