Creates a filter that matches all documents where the value of a field is an array that contains all the specified values.
Creates a filter that matches all documents where the value of a field is an array that contains all the specified values.
the value type
the field name
the list of values
the filter
Creates a filter that performs a logical AND of the provided list of 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:
and(eq("x", 1), lt("y", 3))
will generate a MongoDB query like:
{x : 1, y : {$lt : 3}}
the list of filters to and together
the filter
Creates a filter that matches all documents where all of the bit positions are clear in the field.
Creates a filter that matches all documents where all of the bit positions are clear in the field.
the field name
the bitmask
the filter
1.1
Requires MongoDB 3.2 or greater
Creates a filter that matches all documents where all of the bit positions are set in the field.
Creates a filter that matches all documents where all of the bit positions are set in the field.
the field name
the bitmask
the filter
1.1
Requires MongoDB 3.2 or greater
Creates a filter that matches all documents where any of the bit positions are clear in the field.
Creates a filter that matches all documents where any of the bit positions are clear in the field.
the field name
the bitmask
the filter
1.1
Requires MongoDB 3.2 or greater
Creates a filter that matches all documents where any of the bit positions are set in the field.
Creates a filter that matches all documents where any of the bit positions are set in the field.
the field name
the bitmask
the filter
1.1
Requires MongoDB 3.2 or greater
Creates a filter that matches all documents where the value of the field is of the specified BSON type.
Creates a filter that matches all documents where the value of the field is of the specified BSON type.
A friendly alias for the type
method.
the field name
the BSON type
the filter
Creates a filter that matches all documents containing a field that is an array where at least one member of the array matches the given filter.
Creates a filter that matches all documents containing a field that is an array where at least one member of the array matches the given filter.
the field name
the filter to apply to each element
the filter
Creates a filter that matches all documents where the value of the field name equals the specified value.
Creates a filter that matches all documents where the value of the field name equals the specified value. Note that this doesn't
actually generate a $eq
operator, as the query language doesn't require it.
the value type
the field name
the value
the filter
Creates a filter that matches all documents where the value of the field name equals the specified value.
Creates a filter that matches all documents where the value of the field name equals the specified value. Note that this does
actually generate a $eq
operator, as the query language doesn't require it.
A friendly alias for the eq
method.
the value type
the field name
the value
the filter
Creates a filter that matches all documents that either contain or do not contain the given field, depending on the value of the exists parameter.
Creates a filter that matches all documents that either contain or do not contain the given field, depending on the value of the exists parameter.
the field name
true to check for existence, false to check for absence
the filter
Creates a filter that matches all documents that contain the given field.
Creates a filter that matches all documents that contain the given field.
the field name
the filter
Allows the use of aggregation expressions within the query language.
Allows the use of aggregation expressions within the query language.
the expression type
the aggregation expression
the filter
2.2
Requires MongoDB 3.6 or greater
Creates a filter that matches all documents containing a field with geospatial data that intersects with the specified shape.
Creates a filter that matches all documents containing a field with geospatial data that intersects with the specified shape.
the field name
the bounding GeoJSON geometry object
the filter
Creates a filter that matches all documents containing a field with geospatial data that intersects with the specified shape.
Creates a filter that matches all documents containing a field with geospatial data that intersects with the specified shape.
the field name
the bounding GeoJSON geometry object
the filter
Creates a filter that matches all documents containing a field with geospatial data that exists entirely within the specified shape.
Creates a filter that matches all documents containing a field with geospatial data that exists entirely within the specified shape.
the field name
the bounding GeoJSON geometry object
the filter
Creates a filter that matches all documents containing a field with geospatial data that exists entirely within the specified shape.
Creates a filter that matches all documents containing a field with geospatial data that exists entirely within the specified shape.
the field name
the bounding GeoJSON geometry object
the filter
Creates a filter that matches all documents containing a field with grid coordinates data that exist entirely within the specified box.
Creates a filter that matches all documents containing a field with grid coordinates data that exist entirely within the specified box.
the field name
the lower left x coordinate of the box
the lower left y coordinate of the box
the upper left x coordinate of the box
the upper left y coordinate of the box
the filter
Creates a filter that matches all documents containing a field with grid coordinates data that exist entirely within the specified circle.
Creates a filter that matches all documents containing a field with grid coordinates data that exist entirely within the specified circle.
the field name
the x coordinate of the circle
the y coordinate of the circle
the radius of the circle, as measured in the units used by the coordinate system
the filter
Creates a filter that matches all documents containing a field with geospatial data (GeoJSON or legacy coordinate pairs) that exist entirely within the specified circle, using spherical geometry.
Creates a filter that matches all documents containing a field 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.
the field name
the x coordinate of the circle
the y coordinate of the circle
the radius of the circle, in radians
the filter
Creates a filter that matches all documents containing a field with grid coordinates data that exist entirely within the specified polygon.
Creates a filter that matches all documents containing a field with grid coordinates data that exist entirely within the specified polygon.
the field name
a Seq of pairs of x, y coordinates. Any extra dimensions are ignored
the filter
Creates a filter that matches all documents where the value of the given field is greater than the specified value.
Creates a filter that matches all documents where the value of the given field is greater than the specified value.
the value type
the field name
the value
the filter
Creates a filter that matches all documents where the value of the given field is greater than or equal to the specified value.
Creates a filter that matches all documents where the value of the given field is greater than or equal to the specified value.
the value type
the field name
the value
the filter
Creates a filter that matches all documents where the value of a field equals any value in the list of specified values.
Creates a filter that matches all documents where the value of a field equals any value in the list of specified values.
the value type
the field name
the list of values
the filter
Creates a filter that matches all documents that validate against the given JSON schema document.
Creates a filter that matches all documents that validate against the given JSON schema document.
the JSON schema to validate against
the filter
2.2
Requires MongoDB 3.6 or greater
Creates a filter that matches all documents where the value of the given field is less than the specified value.
Creates a filter that matches all documents where the value of the given field is less than the specified value.
the value type
the field name
the value
the filter
Creates a filter that matches all documents where the value of the given field is less than or equal to the specified value.
Creates a filter that matches all documents where the value of the given field is less than or equal to the specified value.
the value type
the field name
the value
the filter
Creates a filter that matches all documents where the value of a field divided by a divisor has the specified remainder (i.e.
Creates a filter that matches all documents where the value of a field divided by a divisor has the specified remainder (i.e. perform a modulo operation to select documents).
the field name
the modulus
the remainder
the filter
Creates a filter that matches all documents where the value of the field name does not equal the specified value.
Creates a filter that matches all documents where the value of the field name does not equal the specified value.
the value type
the field name
the value
the filter
Creates a filter that matches all documents containing a field with geospatial data that is near the specified point.
Creates a filter that matches all documents containing a field with geospatial data that is near the specified point.
the field name
the x coordinate
the y coordinate
the optional maximum distance from the point, in radians
the optional minimum distance from the point, in radians
the filter
Creates a filter that matches all documents containing a field with geospatial data that is near the specified point.
Creates a filter that matches all documents containing a field with geospatial data that is near the specified point.
the field name
the x coordinate
the y coordinate
the filter
Creates a filter that matches all documents containing a field with geospatial data that is near the specified GeoJSON point.
Creates a filter that matches all documents containing a field with geospatial data that is near the specified GeoJSON point.
the field name
the bounding GeoJSON geometry object
the optional maximum distance from the point, in meters
the optional minimum distance from the point, in meters
the filter
Creates a filter that matches all documents containing a field with geospatial data that is near the specified GeoJSON point.
Creates a filter that matches all documents containing a field with geospatial data that is near the specified GeoJSON point.
the field name
the bounding GeoJSON geometry object
the filter
Creates a filter that matches all documents containing a field with geospatial data that is near the specified GeoJSON point.
Creates a filter that matches all documents containing a field with geospatial data that is near the specified GeoJSON point.
the field name
the bounding GeoJSON geometry object
the optional maximum distance from the point, in meters
the optional minimum distance from the point, in meters
the filter
Creates a filter that matches all documents containing a field with geospatial data that is near the specified GeoJSON point.
Creates a filter that matches all documents containing a field with geospatial data that is near the specified GeoJSON point.
the field name
the bounding GeoJSON geometry object
the filter
Creates a filter that matches all documents containing a field with geospatial data that is near the specified point using spherical geometry.
Creates a filter that matches all documents containing a field with geospatial data that is near the specified point using spherical geometry.
the field name
the x coordinate
the y coordinate
the optional maximum distance from the point, in radians
the optional minimum distance from the point, in radians
the filter
Creates a filter that matches all documents containing a field with geospatial data that is near the specified point using spherical geometry.
Creates a filter that matches all documents containing a field with geospatial data that is near the specified point using spherical geometry.
the field name
the x coordinate
the y coordinate
the filter
Creates a filter that matches all documents containing a field with geospatial data that is near the specified GeoJSON point using spherical geometry.
Creates a filter that matches all documents containing a field with geospatial data that is near the specified GeoJSON point using spherical geometry.
the field name
the bounding GeoJSON geometry object
the optional maximum distance from the point, in meters
the optional minimum distance from the point, in meters
the filter
Creates a filter that matches all documents containing a field with geospatial data that is near the specified GeoJSON point using spherical geometry.
Creates a filter that matches all documents containing a field with geospatial data that is near the specified GeoJSON point using spherical geometry.
the field name
the bounding GeoJSON geometry object
the filter
Creates a filter that matches all documents containing a field with geospatial data that is near the specified GeoJSON point using spherical geometry.
Creates a filter that matches all documents containing a field with geospatial data that is near the specified GeoJSON point using spherical geometry.
the field name
the bounding GeoJSON geometry object
the optional maximum distance from the point, in meters
the optional minimum distance from the point, in meters
the filter
Creates a filter that matches all documents containing a field with geospatial data that is near the specified GeoJSON point using spherical geometry.
Creates a filter that matches all documents containing a field with geospatial data that is near the specified GeoJSON point using spherical geometry.
the field name
the bounding GeoJSON geometry object
the filter
Creates a filter that matches all documents where the value of a field does not equal any of the specified values or does not exist.
Creates a filter that matches all documents where the value of a field does not equal any of the specified values or does not exist.
the value type
the field name
the list of values
the filter
Creates a filter that performs a logical NOR operation on all the specified filters.
Creates a filter that performs a logical NOR operation on all the specified filters.
the list of values
the filter
Creates a filter that matches all documents that do not match the passed in 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:
not(eq("x", 1))
will generate a MongoDB query like:
{x :$not: {$eq : 1}}
the value
the filter
Creates a filter that matches all documents where the value of the field name does not equal the specified value.
Creates a filter that matches all documents where the value of the field name does not equal the specified value.
A friendly alias for the neq
method.
the value type
the field name
the value
the filter
Creates a filter that preforms a logical OR of the provided list of filters.
Creates a filter that preforms a logical OR of the provided list of filters.
the list of filters to and together
the filter
Creates a filter that matches all documents where the value of the field matches the given regular expression pattern with the given options applied.
Creates a filter that matches all documents where the value of the field matches the given regular expression pattern with the given options applied.
the field name
the regex
the filter
1.0
Creates a filter that matches all documents where the value of the field matches the given regular expression pattern with the given options applied.
Creates a filter that matches all documents where the value of the field matches the given regular expression pattern with the given options applied.
the field name
the pattern
the options
the filter
Creates a filter that matches all documents where the value of the field matches the given regular expression pattern with the given options applied.
Creates a filter that matches all documents where the value of the field matches the given regular expression pattern with the given options applied.
the field name
the pattern
the filter
Creates a filter that matches all documents where the value of a field is an array of the specified size.
Creates a filter that matches all documents where the value of a field is an array of the specified size.
the field name
the size of the array
the filter
Creates a filter that matches all documents matching the given search term using the given language.
Creates a filter that matches all documents matching the given search term using the given language.
the search term
the text search options to use
the filter
1.1
Creates a filter that matches all documents matching the given search term.
Creates a filter that matches all documents matching the given search term.
the search term
the filter
Creates a filter that matches all documents where the value of the field is of the specified BSON type.
Creates a filter that matches all documents where the value of the field is of the specified BSON type.
the field name
the BSON type
the filter
Creates a filter that matches all documents for which the given expression is true.
Creates a filter that matches all documents for which the given expression is true.
the JavaScript expression
the filter
Creates a filter that matches all documents matching the given search term using the given language.
Creates a filter that matches all documents matching the given search term using the given language.
the search term
the language to use for stop words
the filter
(Since version 1.1) Use Filters.text(String, TextSearchOptions)
insread
A factory for query filters. A convenient way to use this class is to statically import all of its methods, which allows usage like:
collection.find(and(eq("x", 1), lt("y", 3)))
1.0