Class Filters


  • public final class Filters
    extends 
    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)));
     
    Since:
    3.0
    • Method Summary

      All Methods Static Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static <TItem> Bson  fieldName, <TItem> values)
      Creates a filter that matches all documents where the value of a field is an array that contains all the specified values.
      static <TItem> Bson  fieldName, TItem... values)
      Creates a filter that matches all documents where the value of a field is an array that contains all the specified values.
      static Bson <Bson> filters)
      Creates a filter that performs a logical AND of the provided list of filters.
      static Bson and​(Bson... filters)
      Creates a filter that performs a logical AND of the provided list of filters.
      static Bson  fieldName, long bitmask)
      Creates a filter that matches all documents where all of the bit positions are clear in the field.
      static Bson  fieldName, long bitmask)
      Creates a filter that matches all documents where all of the bit positions are set in the field.
      static Bson  fieldName, long bitmask)
      Creates a filter that matches all documents where any of the bit positions are clear in the field.
      static Bson  fieldName, long bitmask)
      Creates a filter that matches all documents where any of the bit positions are set in the field.
      static Bson  fieldName, Bson 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.
      static <TItem> Bson  fieldName, TItem value)
      Creates a filter that matches all documents where the value of the field name equals the specified value.
      static <TItem> Bson eq​(TItem value)
      Creates a filter that matches all documents where the value of _id field equals the specified value.
      static Bson  fieldName)
      Creates a filter that matches all documents that contain the given field.
      static Bson  fieldName, boolean exists)
      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.
      static <TExpression>
      Bson
      expr​(TExpression expression)
      Allows the use of aggregation expressions within the query language.
      static Bson  fieldName, Geometry geometry)
      Creates a filter that matches all documents containing a field with geospatial data that intersects with the specified shape.
      static Bson  fieldName, Bson geometry)
      Creates a filter that matches all documents containing a field with geospatial data that intersects with the specified shape.
      static Bson  fieldName, Geometry geometry)
      Creates a filter that matches all documents containing a field with geospatial data that exists entirely within the specified shape.
      static Bson  fieldName, Bson geometry)
      Creates a filter that matches all documents containing a field with geospatial data that exists entirely within the specified shape.
      static Bson  fieldName, double lowerLeftX, double lowerLeftY, double upperRightX, double upperRightY)
      Creates a filter that matches all documents containing a field with grid coordinates data that exist entirely within the specified box.
      static Bson  fieldName, double x, double y, double radius)
      Creates a filter that matches all documents containing a field with grid coordinates data that exist entirely within the specified circle.
      static Bson  fieldName, double x, double y, double radius)
      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.
      static Bson  fieldName, <<>> points)
      Creates a filter that matches all documents containing a field with grid coordinates data that exist entirely within the specified polygon.
      static <TItem> Bson  fieldName, TItem value)
      Creates a filter that matches all documents where the value of the given field is greater than the specified value.
      static <TItem> Bson  fieldName, TItem value)
      Creates a filter that matches all documents where the value of the given field is greater than or equal to the specified value.
      static <TItem> Bson  fieldName, <TItem> values)
      Creates a filter that matches all documents where the value of a field equals any value in the list of specified values.
      static <TItem> Bson  fieldName, TItem... values)
      Creates a filter that matches all documents where the value of a field equals any value in the list of specified values.
      static Bson jsonSchema​(Bson schema)
      Creates a filter that matches all documents that validate against the given JSON schema document.
      static <TItem> Bson  fieldName, TItem value)
      Creates a filter that matches all documents where the value of the given field is less than the specified value.
      static <TItem> Bson  fieldName, TItem value)
      Creates a filter that matches all documents where the value of the given field is less than or equal to the specified value.
      static Bson  fieldName, long divisor, long remainder)
      Creates a filter that matches all documents where the value of a field divided by a divisor has the specified remainder (i.e.
      static <TItem> Bson  fieldName, TItem value)
      Creates a filter that matches all documents where the value of the field name does not equal the specified value.
      static Bson  fieldName, double x, double y,  maxDistance,  minDistance)
      Creates a filter that matches all documents containing a field with geospatial data that is near the specified point.
      static Bson  fieldName, Point geometry,  maxDistance,  minDistance)
      Creates a filter that matches all documents containing a field with geospatial data that is near the specified GeoJSON point.
      static Bson  fieldName, Bson geometry,  maxDistance,  minDistance)
      Creates a filter that matches all documents containing a field with geospatial data that is near the specified GeoJSON point.
      static Bson  fieldName, double x, double y,  maxDistance,  minDistance)
      Creates a filter that matches all documents containing a field with geospatial data that is near the specified point using spherical geometry.
      static Bson  fieldName, Point geometry,  maxDistance,  minDistance)
      Creates a filter that matches all documents containing a field with geospatial data that is near the specified GeoJSON point using spherical geometry.
      static Bson  fieldName, Bson geometry,  maxDistance,  minDistance)
      Creates a filter that matches all documents containing a field with geospatial data that is near the specified GeoJSON point using spherical geometry.
      static <TItem> Bson  fieldName, <TItem> values)
      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.
      static <TItem> Bson  fieldName, TItem... values)
      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.
      static Bson <Bson> filters)
      Creates a filter that performs a logical NOR operation on all the specified filters.
      static Bson nor​(Bson... filters)
      Creates a filter that performs a logical NOR operation on all the specified filters.
      static Bson not​(Bson filter)
      Creates a filter that matches all documents that do not match the passed in filter.
      static Bson <Bson> filters)
      Creates a filter that preforms a logical OR of the provided list of filters.
      static Bson or​(Bson... filters)
      Creates a filter that preforms a logical OR of the provided list of filters.
      static Bson  fieldName,  pattern)
      Creates a filter that matches all documents where the value of the field matches the given regular expression pattern with the given options applied.
      static Bson  fieldName,  pattern,  options)
      Creates a filter that matches all documents where the value of the field matches the given regular expression pattern with the given options applied.
      static Bson  fieldName,  pattern)
      Creates a filter that matches all documents where the value of the field matches the given regular expression pattern with the given options applied.
      static Bson  fieldName, int size)
      Creates a filter that matches all documents where the value of a field is an array of the specified size.
      static Bson  search)
      Creates a filter that matches all documents matching the given search term.
      static Bson  search, TextSearchOptions textSearchOptions)
      Creates a filter that matches all documents matching the given the search term with the given text search options.
      static Bson  search,  language)
      static Bson  fieldName,  type)
      Creates a filter that matches all documents where the value of the field is of the specified BSON type.
      static Bson  fieldName, BsonType type)
      Creates a filter that matches all documents where the value of the field is of the specified BSON type.
      static Bson  javaScriptExpression)
      Creates a filter that matches all documents for which the given expression is true.
      • Methods inherited from class java.lang.

        , , , , , , , , , ,
    • Method Detail

      • eq

        public static <TItem> Bson eq​(@Nullable
                                      TItem value)
        Creates a filter that matches all documents where the value of _id field equals the specified value. Note that this doesn't actually generate a $eq operator, as the query language doesn't require it.
        Type Parameters:
        TItem - the value type
        Parameters:
        value - the value, which may be null
        Returns:
        the filter
        Since:
        3.4
        MongoDB documentation
      • eq

        public static <TItem>  fieldName,
                                      @Nullable
                                      TItem 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.
        Type Parameters:
        TItem - the value type
        Parameters:
        fieldName - the field name
        value - the value, which may be null
        Returns:
        the filter
        MongoDB documentation
      • ne

        public static <TItem>  fieldName,
                                      @Nullable
                                      TItem value)
        Creates a filter that matches all documents where the value of the field name does not equal the specified value.
        Type Parameters:
        TItem - the value type
        Parameters:
        fieldName - the field name
        value - the value, which may be null
        Returns:
        the filter
        MongoDB documentation
      • gt

        public static <TItem>  fieldName,
                                      TItem value)
        Creates a filter that matches all documents where the value of the given field is greater than the specified value.
        Type Parameters:
        TItem - the value type
        Parameters:
        fieldName - the field name
        value - the value
        Returns:
        the filter
        MongoDB documentation
      • lt

        public static <TItem>  fieldName,
                                      TItem value)
        Creates a filter that matches all documents where the value of the given field is less than the specified value.
        Type Parameters:
        TItem - the value type
        Parameters:
        fieldName - the field name
        value - the value
        Returns:
        the filter
        MongoDB documentation
      • gte

        public static <TItem>  fieldName,
                                       TItem value)
        Creates a filter that matches all documents where the value of the given field is greater than or equal to the specified value.
        Type Parameters:
        TItem - the value type
        Parameters:
        fieldName - the field name
        value - the value
        Returns:
        the filter
        MongoDB documentation
      • lte

        public static <TItem>  fieldName,
                                       TItem value)
        Creates a filter that matches all documents where the value of the given field is less than or equal to the specified value.
        Type Parameters:
        TItem - the value type
        Parameters:
        fieldName - the field name
        value - the value
        Returns:
        the filter
        MongoDB documentation
      • in

        public static <TItem>  fieldName,
                                      TItem... values)
        Creates a filter that matches all documents where the value of a field equals any value in the list of specified values.
        Type Parameters:
        TItem - the value type
        Parameters:
        fieldName - the field name
        values - the list of values
        Returns:
        the filter
        MongoDB documentation
      • in

        public static <TItem>  fieldName,
                                      <TItem> values)
        Creates a filter that matches all documents where the value of a field equals any value in the list of specified values.
        Type Parameters:
        TItem - the value type
        Parameters:
        fieldName - the field name
        values - the list of values
        Returns:
        the filter
        MongoDB documentation
      • nin

        public static <TItem>  fieldName,
                                       TItem... values)
        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.
        Type Parameters:
        TItem - the value type
        Parameters:
        fieldName - the field name
        values - the list of values
        Returns:
        the filter
        MongoDB documentation
      • nin

        public static <TItem>  fieldName,
                                       <TItem> values)
        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.
        Type Parameters:
        TItem - the value type
        Parameters:
        fieldName - the field name
        values - the list of values
        Returns:
        the filter
        MongoDB documentation
      • and

        public static <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:
            and(eq("x", 1), lt("y", 3))
         
        will generate a MongoDB query like:
            {x : 1, y : {$lt : 3}}
         
        Parameters:
        filters - the list of filters to and together
        Returns:
        the filter
        MongoDB documentation
      • and

        public static Bson and​(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:
            and(eq("x", 1), lt("y", 3))
         
        will generate a MongoDB query like:
            {x : 1, y : {$lt : 3}}
         
        Parameters:
        filters - the list of filters to and together
        Returns:
        the filter
        MongoDB documentation
      • or

        public static <Bson> filters)
        Creates a filter that preforms a logical OR of the provided list of filters.
        Parameters:
        filters - the list of filters to and together
        Returns:
        the filter
        MongoDB documentation
      • or

        public static Bson or​(Bson... filters)
        Creates a filter that preforms a logical OR of the provided list of filters.
        Parameters:
        filters - the list of filters to and together
        Returns:
        the filter
        MongoDB documentation
      • not

        public static Bson not​(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:
            not(eq("x", 1))
         
        will generate a MongoDB query like:
            {x : $not: {$eq : 1}}
         
        Parameters:
        filter - the value
        Returns:
        the filter
        MongoDB documentation
      • nor

        public static Bson nor​(Bson... filters)
        Creates a filter that performs a logical NOR operation on all the specified filters.
        Parameters:
        filters - the list of values
        Returns:
        the filter
        MongoDB documentation
      • nor

        public static <Bson> filters)
        Creates a filter that performs a logical NOR operation on all the specified filters.
        Parameters:
        filters - the list of values
        Returns:
        the filter
        MongoDB documentation
      • exists

        public static  fieldName)
        Creates a filter that matches all documents that contain the given field.
        Parameters:
        fieldName - the field name
        Returns:
        the filter
        MongoDB documentation
      • exists

        public static  fieldName,
                                  boolean exists)
        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.
        Parameters:
        fieldName - the field name
        exists - true to check for existence, false to check for absence
        Returns:
        the filter
        MongoDB documentation
      • type

        public static  fieldName,
                                BsonType type)
        Creates a filter that matches all documents where the value of the field is of the specified BSON type.
        Parameters:
        fieldName - the field name
        type - the BSON type
        Returns:
        the filter
        MongoDB documentation
      • type

        public static  fieldName,
                                 type)
        Creates a filter that matches all documents where the value of the field is of the specified BSON type.
        Parameters:
        fieldName - the field name
        type - the string representation of the BSON type
        Returns:
        the filter
        MongoDB documentation
      • mod

        public static  fieldName,
                               long divisor,
                               long remainder)
        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).
        Parameters:
        fieldName - the field name
        divisor - the modulus
        remainder - the remainder
        Returns:
        the filter
        MongoDB documentation
      • regex

        public static  fieldName,
                                  pattern)
        Creates a filter that matches all documents where the value of the field matches the given regular expression pattern with the given options applied.
        Parameters:
        fieldName - the field name
        pattern - the pattern
        Returns:
        the filter
        MongoDB documentation
      • regex

        public static  fieldName,
                                  pattern,
                                 @Nullable
                                  options)
        Creates a filter that matches all documents where the value of the field matches the given regular expression pattern with the given options applied.
        Parameters:
        fieldName - the field name
        pattern - the pattern
        options - the options
        Returns:
        the filter
        MongoDB documentation
      • regex

        public static  fieldName,
                                  pattern)
        Creates a filter that matches all documents where the value of the field matches the given regular expression pattern with the given options applied.
        Parameters:
        fieldName - the field name
        pattern - the pattern
        Returns:
        the filter
        MongoDB documentation
      • text

        public static  search)
        Creates a filter that matches all documents matching the given search term.
        Parameters:
        search - the search term
        Returns:
        the filter
        MongoDB documentation
      • text

        public static  search,
                                 language)
        Creates a filter that matches all documents matching the given search term using the given language.
        Parameters:
        search - the search term
        language - the language to use for stop words
        Returns:
        the filter
        MongoDB documentation
      • text

        public static  search,
                                TextSearchOptions textSearchOptions)
        Creates a filter that matches all documents matching the given the search term with the given text search options.
        Parameters:
        search - the search term
        textSearchOptions - the text search options to use
        Returns:
        the filter
        Since:
        3.2
        MongoDB documentation
      • where

        public static  javaScriptExpression)
        Creates a filter that matches all documents for which the given expression is true.
        Parameters:
        javaScriptExpression - the JavaScript expression
        Returns:
        the filter
        MongoDB documentation
      • expr

        public static <TExpression> Bson expr​(TExpression expression)
        Allows the use of aggregation expressions within the query language.
        Type Parameters:
        TExpression - the expression type
        Parameters:
        expression - the aggregation expression
        Returns:
        the filter
        Since:
        3.6
        MongoDB documentation
        Since server release
      • all

        public static <TItem>  fieldName,
                                       TItem... values)
        Creates a filter that matches all documents where the value of a field is an array that contains all the specified values.
        Type Parameters:
        TItem - the value type
        Parameters:
        fieldName - the field name
        values - the list of values
        Returns:
        the filter
        MongoDB documentation
      • all

        public static <TItem>  fieldName,
                                       <TItem> values)
        Creates a filter that matches all documents where the value of a field is an array that contains all the specified values.
        Type Parameters:
        TItem - the value type
        Parameters:
        fieldName - the field name
        values - the list of values
        Returns:
        the filter
        MongoDB documentation
      • elemMatch

        public static  fieldName,
                                     Bson 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.
        Parameters:
        fieldName - the field name
        filter - the filter to apply to each element
        Returns:
        the filter
        MongoDB documentation
      • size

        public static  fieldName,
                                int size)
        Creates a filter that matches all documents where the value of a field is an array of the specified size.
        Parameters:
        fieldName - the field name
        size - the size of the array
        Returns:
        the filter
        MongoDB documentation
      • bitsAllClear

        public static  fieldName,
                                        long bitmask)
        Creates a filter that matches all documents where all of the bit positions are clear in the field.
        Parameters:
        fieldName - the field name
        bitmask - the bitmask
        Returns:
        the filter
        Since:
        3.2
        MongoDB documentation
        Since server release
      • bitsAllSet

        public static  fieldName,
                                      long bitmask)
        Creates a filter that matches all documents where all of the bit positions are set in the field.
        Parameters:
        fieldName - the field name
        bitmask - the bitmask
        Returns:
        the filter
        Since:
        3.2
        MongoDB documentation
        Since server release
      • bitsAnyClear

        public static  fieldName,
                                        long bitmask)
        Creates a filter that matches all documents where any of the bit positions are clear in the field.
        Parameters:
        fieldName - the field name
        bitmask - the bitmask
        Returns:
        the filter
        Since:
        3.2
        MongoDB documentation
        Since server release
      • bitsAnySet

        public static  fieldName,
                                      long bitmask)
        Creates a filter that matches all documents where any of the bit positions are set in the field.
        Parameters:
        fieldName - the field name
        bitmask - the bitmask
        Returns:
        the filter
        Since:
        3.2
        MongoDB documentation
        Since server release
      • geoWithin

        public static  fieldName,
                                     Geometry geometry)
        Creates a filter that matches all documents containing a field with geospatial data that exists entirely within the specified shape.
        Parameters:
        fieldName - the field name
        geometry - the bounding GeoJSON geometry object
        Returns:
        the filter
        Since:
        3.1
        MongoDB documentation
        Since server release
      • geoWithin

        public static  fieldName,
                                     Bson geometry)
        Creates a filter that matches all documents containing a field with geospatial data that exists entirely within the specified shape.
        Parameters:
        fieldName - the field name
        geometry - the bounding GeoJSON geometry object
        Returns:
        the filter
        Since:
        3.1
        MongoDB documentation
        Since server release
      • geoWithinBox

        public static  fieldName,
                                        double lowerLeftX,
                                        double lowerLeftY,
                                        double upperRightX,
                                        double upperRightY)
        Creates a filter that matches all documents containing a field with grid coordinates data that exist entirely within the specified box.
        Parameters:
        fieldName - the field name
        lowerLeftX - the lower left x coordinate of the box
        lowerLeftY - the lower left y coordinate of the box
        upperRightX - the upper left x coordinate of the box
        upperRightY - the upper left y coordinate of the box
        Returns:
        the filter
        Since:
        3.1
        MongoDB documentation
        Since server release
      • geoWithinPolygon

        public static  fieldName,
                                            <<>> points)
        Creates a filter that matches all documents containing a field with grid coordinates data that exist entirely within the specified polygon.
        Parameters:
        fieldName - the field name
        points - a list of pairs of x, y coordinates. Any extra dimensions are ignored
        Returns:
        the filter
        Since:
        3.1
        MongoDB documentation
        Since server release
      • geoWithinCenter

        public static  fieldName,
                                           double x,
                                           double y,
                                           double radius)
        Creates a filter that matches all documents containing a field with grid coordinates data that exist entirely within the specified circle.
        Parameters:
        fieldName - the field name
        x - the x coordinate of the circle
        y - the y coordinate of the circle
        radius - the radius of the circle, as measured in the units used by the coordinate system
        Returns:
        the filter
        Since:
        3.1
        MongoDB documentation
        Since server release
      • geoWithinCenterSphere

        public static  fieldName,
                                                 double x,
                                                 double y,
                                                 double radius)
        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.
        Parameters:
        fieldName - the field name
        x - the x coordinate of the circle
        y - the y coordinate of the circle
        radius - the radius of the circle, in radians
        Returns:
        the filter
        Since:
        3.1
        MongoDB documentation
        Since server release
      • geoIntersects

        public static  fieldName,
                                         Bson geometry)
        Creates a filter that matches all documents containing a field with geospatial data that intersects with the specified shape.
        Parameters:
        fieldName - the field name
        geometry - the bounding GeoJSON geometry object
        Returns:
        the filter
        Since:
        3.1
        MongoDB documentation
        Since server release
      • geoIntersects

        public static  fieldName,
                                         Geometry geometry)
        Creates a filter that matches all documents containing a field with geospatial data that intersects with the specified shape.
        Parameters:
        fieldName - the field name
        geometry - the bounding GeoJSON geometry object
        Returns:
        the filter
        Since:
        3.1
        MongoDB documentation
        Since server release
      • near

        public static  fieldName,
                                Point geometry,
                                @Nullable
                                 maxDistance,
                                @Nullable
                                 minDistance)
        Creates a filter that matches all documents containing a field with geospatial data that is near the specified GeoJSON point.
        Parameters:
        fieldName - the field name
        geometry - the bounding GeoJSON geometry object
        maxDistance - the maximum distance from the point, in meters. It may be null.
        minDistance - the minimum distance from the point, in meters. It may be null.
        Returns:
        the filter
        Since:
        3.1
        MongoDB documentation
        Since server release
      • near

        public static  fieldName,
                                Bson geometry,
                                @Nullable
                                 maxDistance,
                                @Nullable
                                 minDistance)
        Creates a filter that matches all documents containing a field with geospatial data that is near the specified GeoJSON point.
        Parameters:
        fieldName - the field name
        geometry - the bounding GeoJSON geometry object
        maxDistance - the maximum distance from the point, in meters. It may be null.
        minDistance - the minimum distance from the point, in meters. It may be null.
        Returns:
        the filter
        Since:
        3.1
        MongoDB documentation
        Since server release
      • near

        public static  fieldName,
                                double x,
                                double y,
                                @Nullable
                                 maxDistance,
                                @Nullable
                                 minDistance)
        Creates a filter that matches all documents containing a field with geospatial data that is near the specified point.
        Parameters:
        fieldName - the field name
        x - the x coordinate
        y - the y coordinate
        maxDistance - the maximum distance from the point, in radians. It may be null.
        minDistance - the minimum distance from the point, in radians. It may be null.
        Returns:
        the filter
        Since:
        3.1
        MongoDB documentation
        Since server release
      • nearSphere

        public static  fieldName,
                                      Point geometry,
                                      @Nullable
                                       maxDistance,
                                      @Nullable
                                       minDistance)
        Creates a filter that matches all documents containing a field with geospatial data that is near the specified GeoJSON point using spherical geometry.
        Parameters:
        fieldName - the field name
        geometry - the bounding GeoJSON geometry object
        maxDistance - the maximum distance from the point, in meters. It may be null.
        minDistance - the minimum distance from the point, in meters. It may be null.
        Returns:
        the filter
        Since:
        3.1
        MongoDB documentation
        Since server release
      • nearSphere

        public static  fieldName,
                                      Bson geometry,
                                      @Nullable
                                       maxDistance,
                                      @Nullable
                                       minDistance)
        Creates a filter that matches all documents containing a field with geospatial data that is near the specified GeoJSON point using spherical geometry.
        Parameters:
        fieldName - the field name
        geometry - the bounding GeoJSON geometry object
        maxDistance - the maximum distance from the point, in meters. It may be null.
        minDistance - the minimum distance from the point, in meters. It may be null.
        Returns:
        the filter
        Since:
        3.1
        MongoDB documentation
        Since server release
      • nearSphere

        public static  fieldName,
                                      double x,
                                      double y,
                                      @Nullable
                                       maxDistance,
                                      @Nullable
                                       minDistance)
        Creates a filter that matches all documents containing a field with geospatial data that is near the specified point using spherical geometry.
        Parameters:
        fieldName - the field name
        x - the x coordinate
        y - the y coordinate
        maxDistance - the maximum distance from the point, in radians. It may be null.
        minDistance - the minimum distance from the point, in radians. It may be null.
        Returns:
        the filter
        Since:
        3.1
        MongoDB documentation
        Since server release
      • jsonSchema

        public static Bson jsonSchema​(Bson schema)
        Creates a filter that matches all documents that validate against the given JSON schema document.
        Parameters:
        schema - the JSON schema to validate against
        Returns:
        the filter
        Since:
        3.6
        MongoDB documentation
        Since server release