Interface FieldEnd<T>

  • Type Parameters:
    T - the type of the FieldEnd
    All Known Implementing Classes:
    FieldEndImpl

    public interface FieldEnd<T>
    Represents a document field in a query and presents the operations available to querying against that field.
    • Method Summary

      All Methods Instance Methods Abstract Methods Deprecated Methods 
      Modifier and Type Method Description
      T contains​(java.lang.String string)
      Checks if a field contains a value
      T containsIgnoreCase​(java.lang.String string)
      Checks if a field contains a value ignoring the case of the values
      T doesNotExist()
      Checks that a field does not exist in a document
      T doesNotHaveThisElement​(java.lang.Object val)
      Deprecated.
      use elemMatch(Query) instead
      T elemMatch​(Query query)
      Checks that a field matches the provided query definition
      T endsWith​(java.lang.String suffix)
      Checks that a field ends with a value
      T endsWithIgnoreCase​(java.lang.String suffix)
      Checks that a field ends with a value ignoring the case of the values
      T equal​(java.lang.Object val)
      Checks that a field equals a value
      T equalIgnoreCase​(java.lang.Object val)
      Checks that a field equals a value
      T exists()
      Checks that a field exists in a document
      T greaterThan​(java.lang.Object val)
      Checks that a field is greater than the value given
      T greaterThanOrEq​(java.lang.Object val)
      Checks that a field is greater than or equal to the value given
      T hasAllOf​(java.lang.Iterable<?> values)
      Checks that a field has all of the values listed.
      T hasAnyOf​(java.lang.Iterable<?> values)
      Checks that a field has any of the values listed.
      T hasNoneOf​(java.lang.Iterable<?> values)
      Checks that a field has none of the values listed.
      T hasThisElement​(java.lang.Object val)
      Deprecated.
      use elemMatch(Query) instead
      T hasThisOne​(java.lang.Object val)
      Checks that a field has the value listed.
      T in​(java.lang.Iterable<?> values)
      Synonym for hasAnyOf(Iterable)
      T intersects​(Geometry geometry)
      This performs a $geoIntersects query, searching documents containing any sort of GeoJson field and returning those where the given geometry intersects with the document shape.
      T intersects​(Geometry geometry, CoordinateReferenceSystem crs)
      This performs a $geoIntersects query, searching documents containing any sort of GeoJson field and returning those where the given geometry intersects with the document shape.
      T lessThan​(java.lang.Object val)
      Checks that a field is less than the value given
      T lessThanOrEq​(java.lang.Object val)
      Checks that a field is less than or equal to the value given
      T mod​(long divisor, long remainder)
      Select documents where the value of a field divided by a divisor has the specified remainder (i.e.
      T near​(double longitude, double latitude)
      Specifies a point for which a geospatial query returns the documents from nearest to farthest.
      T near​(double longitude, double latitude, boolean spherical)
      Specifies a point for which a geospatial query returns the documents from nearest to farthest.
      T near​(double longitude, double latitude, double radius)
      Specifies a point for which a geospatial query returns the documents from nearest to farthest.
      T near​(double longitude, double latitude, double radius, boolean spherical)
      Specifies a point for which a geospatial query returns the documents from nearest to farthest.
      T near​(Point point)
      This runs a $near query to check for documents geographically close to the given Point - this Point represents a GeoJSON point type.
      T near​(Point point, int maxDistance)
      T near​(Point point, java.lang.Double maxDistance, java.lang.Double minDistance)
      Specifies a point for which a geospatial query returns the documents from nearest to farthest.
      T nearSphere​(Point point)
      Specifies a point for which a geospatial query returns the documents from nearest to farthest.
      T nearSphere​(Point point, java.lang.Double maxDistance, java.lang.Double minDistance)
      Specifies a point for which a geospatial query returns the documents from nearest to farthest.
      FieldEnd<T> not()
      Negates the criteria applied to the field
      T notEqual​(java.lang.Object val)
      Checks that a field doesn't equal a value
      T notIn​(java.lang.Iterable<?> values)
      T sizeEq​(int val)
      Checks the size of a field.
      T startsWith​(java.lang.String prefix)
      Checks that a field starts with a value
      T startsWithIgnoreCase​(java.lang.String prefix)
      Checks that a field starts with a value ignoring the case of the values
      T type​(Type type)
      Checks the type of a field
      T within​(MultiPolygon boundaries)
      This runs the $geoWithin query, returning documents with GeoJson fields whose area falls within the given boundaries.
      T within​(MultiPolygon boundaries, CoordinateReferenceSystem crs)
      This runs the $geoWithin query, returning documents with GeoJson fields whose area falls within the given boundaries.
      T within​(Polygon boundary)
      This runs the $geoWithin query, returning documents with GeoJson fields whose area falls within the given boundary.
      T within​(Polygon boundary, CoordinateReferenceSystem crs)
      This runs the $geoWithin query, returning documents with GeoJson fields whose area falls within the given boundary.
      T within​(Shape shape)
      This implements the $geoWithin operator and is only compatible with mongo 2.4 or greater.
    • Method Detail

      • contains

        T contains​(java.lang.String string)
        Checks if a field contains a value
        Parameters:
        string - the value to check for
        Returns:
        T
        MongoDB documentation
        reference/operator/query/regex/ $regex
      • containsIgnoreCase

        T containsIgnoreCase​(java.lang.String string)
        Checks if a field contains a value ignoring the case of the values
        Parameters:
        string - the value to check for
        Returns:
        T
        MongoDB documentation
        reference/operator/query/regex/ $regex
      • endsWith

        T endsWith​(java.lang.String suffix)
        Checks that a field ends with a value
        Parameters:
        suffix - the value to check
        Returns:
        T
        MongoDB documentation
        reference/operator/query/regex/ $regex
      • endsWithIgnoreCase

        T endsWithIgnoreCase​(java.lang.String suffix)
        Checks that a field ends with a value ignoring the case of the values
        Parameters:
        suffix - the value to check
        Returns:
        T
        MongoDB documentation
        reference/operator/query/regex/ $regex
      • equal

        T equal​(java.lang.Object val)
        Checks that a field equals a value
        Parameters:
        val - the value to check
        Returns:
        T
        MongoDB documentation
        reference/operator/query/eq/ $eq
      • equalIgnoreCase

        T equalIgnoreCase​(java.lang.Object val)
        Checks that a field equals a value
        Parameters:
        val - the value to check
        Returns:
        T
        MongoDB documentation
        reference/operator/query/eq/ $eq
      • greaterThan

        T greaterThan​(java.lang.Object val)
        Checks that a field is greater than the value given
        Parameters:
        val - the value to check against
        Returns:
        T
        MongoDB documentation
        reference/operator/query/gt/ $gt
      • greaterThanOrEq

        T greaterThanOrEq​(java.lang.Object val)
        Checks that a field is greater than or equal to the value given
        Parameters:
        val - the value to check against
        Returns:
        T
        MongoDB documentation
        reference/operator/query/gte/ $gte
      • hasAllOf

        T hasAllOf​(java.lang.Iterable<?> values)
        Checks that a field has all of the values listed.
        Parameters:
        values - the values to check against
        Returns:
        T
        MongoDB documentation
        reference/operator/query/all/ $all
      • hasAnyOf

        T hasAnyOf​(java.lang.Iterable<?> values)
        Checks that a field has any of the values listed.
        Parameters:
        values - the values to check against
        Returns:
        T
        MongoDB documentation
        reference/operator/query/in/ $in
      • hasNoneOf

        T hasNoneOf​(java.lang.Iterable<?> values)
        Checks that a field has none of the values listed.
        Parameters:
        values - the values to check against
        Returns:
        T
        MongoDB documentation
        reference/operator/query/nin/ $nin
      • hasThisElement

        @Deprecated
        T hasThisElement​(java.lang.Object val)
        Deprecated.
        use elemMatch(Query) instead
        Checks that a field has the value listed. The options to store null/empty values apply here so to do partial matches on embedded objects, pass a reference to a partially populated instance with only the values of interest set to the values to check.
        Parameters:
        val - the value to check against
        Returns:
        T
        See Also:
        MapperOptions
        MongoDB documentation
        reference/operator/query/elemMatch/ $elemMatch
      • doesNotHaveThisElement

        @Deprecated
        T doesNotHaveThisElement​(java.lang.Object val)
        Deprecated.
        use elemMatch(Query) instead
        Checks that a field does not have the value listed. The options to store null/empty values apply here so to do partial matches on embedded objects, pass a reference to a partially populated instance with only the values of interest set to the values to check.
        Parameters:
        val - the value to check against
        Returns:
        T
        See Also:
        MapperOptions
        MongoDB documentation
        reference/operator/query/elemMatch/ $elemMatch
      • hasThisOne

        T hasThisOne​(java.lang.Object val)
        Checks that a field has the value listed.
        Parameters:
        val - the value to check against
        Returns:
        T
        MongoDB documentation
        reference/operator/query/eq/ $eq
      • intersects

        T intersects​(Geometry geometry)
        This performs a $geoIntersects query, searching documents containing any sort of GeoJson field and returning those where the given geometry intersects with the document shape. This includes cases where the data and the specified object share an edge.
        Parameters:
        geometry - the shape to use to query for any stored shapes that intersect
        Returns:
        T
        Since server release
        2.4
        MongoDB documentation
        reference/operator/query/geoIntersects/ $geoIntersects
      • intersects

        T intersects​(Geometry geometry,
                     CoordinateReferenceSystem crs)
        This performs a $geoIntersects query, searching documents containing any sort of GeoJson field and returning those where the given geometry intersects with the document shape. This includes cases where the data and the specified object share an edge.
        Parameters:
        geometry - the shape to use to query for any stored shapes that intersect
        crs - the coordinate reference system to use with the query
        Returns:
        T
        Since server release
        2.4
        MongoDB documentation
        reference/operator/query/geometry $geometry
      • lessThan

        T lessThan​(java.lang.Object val)
        Checks that a field is less than the value given
        Parameters:
        val - the value to check against
        Returns:
        T
        MongoDB documentation
        reference/operator/query/lt/ $lt
      • lessThanOrEq

        T lessThanOrEq​(java.lang.Object val)
        Checks that a field is less than or equal to the value given
        Parameters:
        val - the value to check against
        Returns:
        T
        MongoDB documentation
        reference/operator/query/lte/ $lte
      • mod

        T mod​(long divisor,
              long remainder)
        Select 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:
        divisor - the divisor to apply
        remainder - the remainder to check for
        Returns:
        T
        MongoDB documentation
        reference/operator/query/mod/ $mod
      • near

        T near​(double longitude,
               double latitude)
        Specifies a point for which a geospatial query returns the documents from nearest to farthest.
        Parameters:
        longitude - the longitude
        latitude - the latitude
        Returns:
        T
        MongoDB documentation
        reference/operator/query/near/ $near
      • near

        T near​(double longitude,
               double latitude,
               boolean spherical)
        Specifies a point for which a geospatial query returns the documents from nearest to farthest.
        Parameters:
        longitude - the longitude
        latitude - the latitude
        spherical - if true, will use spherical geometry ($nearSphere) when analyzing documents
        Returns:
        T
        MongoDB documentation
        reference/operator/query/near/ $near
        reference/operator/query/nearSphere/ $nearSphere
      • near

        T near​(double longitude,
               double latitude,
               double radius)
        Specifies a point for which a geospatial query returns the documents from nearest to farthest.
        Parameters:
        longitude - the longitude
        latitude - the latitude
        radius - the max distance to consider
        Returns:
        T
        MongoDB documentation
        reference/operator/query/near/ $near
      • near

        T near​(double longitude,
               double latitude,
               double radius,
               boolean spherical)
        Specifies a point for which a geospatial query returns the documents from nearest to farthest.
        Parameters:
        longitude - the longitude
        latitude - the latitude
        radius - the max distance to consider
        spherical - if true, will use spherical geometry ($nearSphere) when analyzing documents
        Returns:
        T
        MongoDB documentation
        reference/operator/query/near/ $near
        reference/operator/query/nearSphere/ $nearSphere
      • near

        @Deprecated
        T near​(Point point,
               int maxDistance)
        This runs a $near query to check for documents geographically close to the given Point - this Point represents a GeoJSON point type. These queries are only supported by MongoDB version 2.4 or greater.
        Parameters:
        point - the point to find results close to
        maxDistance - the radius, in meters, to find the results inside
        Returns:
        T
        MongoDB documentation
        reference/operator/query/near/ $near
      • near

        T near​(Point point)
        This runs a $near query to check for documents geographically close to the given Point - this Point represents a GeoJSON point type. These queries are only supported by MongoDB version 2.4 or greater.
        Parameters:
        point - the point to find results close to
        Returns:
        T
        MongoDB documentation
        reference/operator/query/near/ $near
      • near

        T near​(Point point,
               java.lang.Double maxDistance,
               java.lang.Double minDistance)
        Specifies a point for which a geospatial query returns the documents from nearest to farthest.
        Parameters:
        point - the point to find results close to
        maxDistance - the maximum distance in meters from the point
        minDistance - the minimum distance in meters from the point
        Returns:
        T
        Since:
        1.5
        MongoDB documentation
        reference/operator/query/near/ $near
      • nearSphere

        T nearSphere​(Point point)
        Specifies a point for which a geospatial query returns the documents from nearest to farthest.
        Parameters:
        point - the point to find results close to
        Returns:
        T
        Since:
        1.5
        MongoDB documentation
        reference/operator/query/nearSphere/ $nearSphere
      • nearSphere

        T nearSphere​(Point point,
                     java.lang.Double maxDistance,
                     java.lang.Double minDistance)
        Specifies a point for which a geospatial query returns the documents from nearest to farthest.
        Parameters:
        point - the point to find results close to
        maxDistance - the maximum distance in meters from the point
        minDistance - the minimum distance in meters from the point
        Returns:
        T
        Since:
        1.5
        MongoDB documentation
        reference/operator/query/nearSphere/ $nearSphere
      • not

        FieldEnd<T> not()
        Negates the criteria applied to the field
        Returns:
        this
      • notEqual

        T notEqual​(java.lang.Object val)
        Checks that a field doesn't equal a value
        Parameters:
        val - the value to check
        Returns:
        T
        MongoDB documentation
        reference/operator/query/ne/ $ne
      • startsWith

        T startsWith​(java.lang.String prefix)
        Checks that a field starts with a value
        Parameters:
        prefix - the value to check
        Returns:
        T
        MongoDB documentation
        reference/operator/query/regex/ $regex
      • startsWithIgnoreCase

        T startsWithIgnoreCase​(java.lang.String prefix)
        Checks that a field starts with a value ignoring the case of the values
        Parameters:
        prefix - the value to check
        Returns:
        T
        MongoDB documentation
        reference/operator/query/regex/ $regex
      • type

        T type​(Type type)
        Checks the type of a field
        Parameters:
        type - the value to check against
        Returns:
        T
      • within

        T within​(Shape shape)
        This implements the $geoWithin operator and is only compatible with mongo 2.4 or greater.
        Parameters:
        shape - the shape to check within
        Returns:
        T
        Since server release
        2.4
        MongoDB documentation
        reference/operator/query/geoWithin/ $geoWithin
      • within

        T within​(Polygon boundary)
        This runs the $geoWithin query, returning documents with GeoJson fields whose area falls within the given boundary. When determining inclusion, MongoDB considers the border of a shape to be part of the shape, subject to the precision of floating point numbers.
        Parameters:
        boundary - a polygon describing the boundary to search within.
        Returns:
        T
        Since server release
        2.4
        MongoDB documentation
        reference/operator/query/geoWithin/ $geoWithin
      • within

        T within​(MultiPolygon boundaries)
        This runs the $geoWithin query, returning documents with GeoJson fields whose area falls within the given boundaries. When determining inclusion, MongoDB considers the border of a shape to be part of the shape, subject to the precision of floating point numbers.
        Parameters:
        boundaries - a multi-polygon describing the areas to search within.
        Returns:
        T
        Since server release
        2.6
        MongoDB documentation
        reference/operator/query/geoWithin/ $geoWithin
      • within

        T within​(Polygon boundary,
                 CoordinateReferenceSystem crs)
        This runs the $geoWithin query, returning documents with GeoJson fields whose area falls within the given boundary. When determining inclusion, MongoDB considers the border of a shape to be part of the shape, subject to the precision of floating point numbers.
        Parameters:
        boundary - a polygon describing the boundary to search within.
        crs - the coordinate reference system to use
        Returns:
        T
        Since server release
        2.4
        MongoDB documentation
        reference/operator/query/geoWithin/ $geoWithin
      • within

        T within​(MultiPolygon boundaries,
                 CoordinateReferenceSystem crs)
        This runs the $geoWithin query, returning documents with GeoJson fields whose area falls within the given boundaries. When determining inclusion, MongoDB considers the border of a shape to be part of the shape, subject to the precision of floating point numbers.

        These queries are only compatible with MongoDB 2.6 or greater.

        Parameters:
        boundaries - a multi-polygon describing the areas to search within.
        crs - the coordinate reference system to use
        Returns:
        T
        Since server release
        2.6
        MongoDB documentation
        reference/operator/query/geoWithin/ $geoWithin