Package dev.morphia.query
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 valueT
containsIgnoreCase(java.lang.String string)
Checks if a field contains a value ignoring the case of the valuesT
doesNotExist()
Checks that a field does not exist in a documentT
doesNotHaveThisElement(java.lang.Object val)
Deprecated.useelemMatch(Query)
insteadT
elemMatch(Query query)
Checks that a field matches the provided query definitionT
endsWith(java.lang.String suffix)
Checks that a field ends with a valueT
endsWithIgnoreCase(java.lang.String suffix)
Checks that a field ends with a value ignoring the case of the valuesT
equal(java.lang.Object val)
Checks that a field equals a valueT
equalIgnoreCase(java.lang.Object val)
Checks that a field equals a valueT
exists()
Checks that a field exists in a documentT
greaterThan(java.lang.Object val)
Checks that a field is greater than the value givenT
greaterThanOrEq(java.lang.Object val)
Checks that a field is greater than or equal to the value givenT
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.useelemMatch(Query)
insteadT
hasThisOne(java.lang.Object val)
Checks that a field has the value listed.T
in(java.lang.Iterable<?> values)
Synonym forhasAnyOf(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 givenT
lessThanOrEq(java.lang.Object val)
Checks that a field is less than or equal to the value givenT
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)
Deprecated.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 fieldT
notEqual(java.lang.Object val)
Checks that a field doesn't equal a valueT
notIn(java.lang.Iterable<?> values)
Synonym forhasNoneOf(Iterable)
T
sizeEq(int val)
Checks the size of a field.T
startsWith(java.lang.String prefix)
Checks that a field starts with a valueT
startsWithIgnoreCase(java.lang.String prefix)
Checks that a field starts with a value ignoring the case of the valuesT
type(Type type)
Checks the type of a fieldT
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
-
doesNotExist
T doesNotExist()
Checks that a field does not exist in a document- Returns:
- T
- MongoDB documentation
- reference/operator/query/exists/ $exists
-
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
-
exists
T exists()
Checks that a field exists in a document- Returns:
- T
- MongoDB documentation
- reference/operator/query/exists/ $exists
-
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.useelemMatch(Query)
insteadChecks 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
-
elemMatch
T elemMatch(Query query)
Checks that a field matches the provided query definition- Parameters:
query
- the query to find certain field values- Returns:
- T
- MongoDB documentation
- reference/operator/query/elemMatch/ $elemMatch
-
doesNotHaveThisElement
@Deprecated T doesNotHaveThisElement(java.lang.Object val)
Deprecated.useelemMatch(Query)
insteadChecks 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
-
in
T in(java.lang.Iterable<?> values)
Synonym forhasAnyOf(Iterable)
- Parameters:
values
- the values to check against- Returns:
- T
- MongoDB documentation
- reference/operator/query/in/ $in
-
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
- MongoDB documentation
- reference/operator/query/geoIntersects/ $geoIntersects
- Since server release
- 2.4
-
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 intersectcrs
- the coordinate reference system to use with the query- Returns:
- T
- MongoDB documentation
- reference/operator/query/geometry $geometry
- Since server release
- 2.4
-
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 applyremainder
- 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 longitudelatitude
- 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 longitudelatitude
- the latitudespherical
- 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 longitudelatitude
- the latituderadius
- 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 longitudelatitude
- the latituderadius
- the max distance to considerspherical
- 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)
Deprecated.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 tomaxDistance
- 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 tomaxDistance
- the maximum distance in meters from the pointminDistance
- 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 tomaxDistance
- the maximum distance in meters from the pointminDistance
- the minimum distance in meters from the point- Returns:
- T
- Since:
- 1.5
- MongoDB documentation
- reference/operator/query/nearSphere/ $nearSphere
-
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
-
notIn
T notIn(java.lang.Iterable<?> values)
Synonym forhasNoneOf(Iterable)
- Parameters:
values
- the values to check against- Returns:
- T
- MongoDB documentation
- reference/operator/query/nin/ $nin
-
sizeEq
T sizeEq(int val)
Checks the size of a field.- Parameters:
val
- the value to check against- Returns:
- T
- MongoDB documentation
- reference/operator/query/size/ $size
-
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
- MongoDB documentation
- reference/operator/query/geoWithin/ $geoWithin
- Since server release
- 2.4
-
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
- MongoDB documentation
- reference/operator/query/geoWithin/ $geoWithin
- Since server release
- 2.4
-
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
- MongoDB documentation
- reference/operator/query/geoWithin/ $geoWithin
- Since server release
- 2.6
-
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
- MongoDB documentation
- reference/operator/query/geoWithin/ $geoWithin
- Since server release
- 2.4
-
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
- MongoDB documentation
- reference/operator/query/geoWithin/ $geoWithin
- Since server release
- 2.6
-
-