public class

Query

extends AbstractQuery
java.lang.Object
   ↳ com.kinvey.java.query.AbstractQuery
     ↳ com.kinvey.java.Query

Class Overview

Query API for creating query requests to AppData store.

Summary

Public Constructors
Query(QueryFilter.QueryFilterBuilder builder)
Constructor for Query API.
Query()
Constructor for Query API.
Public Methods
Query all(String key, Object[] value)
Add a filter condition for a specific field holds an array and containsa ll the values
Query and(AbstractQuery query)
Joins a second Query filter to the current query object and connects them with a logical AND
Query endsWith(String key, Object value)
Add a filter condition for a specific field for strings that ends with the given value.
Query equals(String key, Object value)
Add a filter condition for a specific field being equal to a value
int getLimit()
int getSkip()
String getSortString()
Query greaterThan(String key, Object value)
Add a filter condition for a specific field being greater than a value
Query greaterThanEqualTo(String key, Object value)
Add a filter condition for a specific field being greater than or equal to a value
Query in(String key, Object[] value)
Add a filter condition for a specific field being in an array of values
Query lessThan(String key, Object value)
Add a filter condition for a specific field being less than than a value
Query lessThanEqualTo(String key, Object value)
Add a filter condition for a specific field being less than or equal to a value
Query nearSphere(String field, double lat, double lon, double maxDistance)
Used on Geospatial fields to return all points near a given point.
Query nearSphere(String field, double lat, double lon)
Used on Geospatial fields to return all points near a given point.
Query not()
Negates the current query's comparison operators
Query notEqual(String key, Object value)
Add a filter condition for a specific field being not equal to a value
Query notIn(String key, Object[] value)
Add a filter condition for a specific field being not in an array of values
Query or(AbstractQuery query)
Joins a second Query filter to the current query object and connects them with a logical OR
Query regEx(String key, Object value)
Add a filter condition for a specific field compared to a regular expression
Query setLimit(int limit)
Sets the maximum number of records to return
Query setSkip(int skip)
Sets the number of records to skip before returning the results (useful for pagination).
Query size(String key, int value)
Add a filter for any array that is of the given size
Query startsWith(String key, Object value)
Add a filter condition for a specific field for strings that start with the given value.
AbstractQuery withinBox(String field, double pointOneLat, double pointOneLon, double pointTwoLat, double pointTwoLon)
AbstractQuery withinPolygon(String field, double pointOneLat, double pointOneLon, double pointTwoLat, double pointTwoLon, double pointThreeLat, double pointThreeLon, double pointFourLat, double pointFourLon)
[Expand]
Inherited Methods
From class com.kinvey.java.query.AbstractQuery
From class java.lang.Object

Public Constructors

public Query (QueryFilter.QueryFilterBuilder builder)

Constructor for Query API. Used to instantiate a query request.

Parameters
builder that implements QueryFilter.builder

public Query ()

Constructor for Query API. Used to instantiate a query request. defaults to using a Mongo DB Query Filter.

Public Methods

public Query all (String key, Object[] value)

Add a filter condition for a specific field holds an array and containsa ll the values

Parameters
key Field to filter on
value An array of values Values
Returns
  • Query object

public Query and (AbstractQuery query)

Joins a second Query filter to the current query object and connects them with a logical AND

Parameters
query The query which contains the QueryFilter to be joined
Returns
  • Query object

public Query endsWith (String key, Object value)

Add a filter condition for a specific field for strings that ends with the given value.

Parameters
key Field to filter on
value Value condition for filter
Returns
  • Query object

public Query equals (String key, Object value)

Add a filter condition for a specific field being equal to a value

Parameters
key Field to filter on
value Value condition for filter
Returns
  • Query object

public int getLimit ()

Returns
  • Current limit

public int getSkip ()

Returns
  • Current skip setting

public String getSortString ()

Returns
  • current sort string

public Query greaterThan (String key, Object value)

Add a filter condition for a specific field being greater than a value

Parameters
key Field to filter on
value Value condition for filter
Returns
  • Query object

public Query greaterThanEqualTo (String key, Object value)

Add a filter condition for a specific field being greater than or equal to a value

Parameters
key Field to filter on
value Value condition for filter
Returns
  • Query object

public Query in (String key, Object[] value)

Add a filter condition for a specific field being in an array of values

Parameters
key Field to filter on
value An array of values
Returns
  • Query object

public Query lessThan (String key, Object value)

Add a filter condition for a specific field being less than than a value

Parameters
key Field to filter on
value Value condition for filter
Returns
  • Query object

public Query lessThanEqualTo (String key, Object value)

Add a filter condition for a specific field being less than or equal to a value

Parameters
key Field to filter on
value Value condition for filter
Returns
  • Query object

public Query nearSphere (String field, double lat, double lon, double maxDistance)

Used on Geospatial fields to return all points near a given point.

Parameters
field The geolocation field to filter on
lat latitude
lon longitude
maxDistance The maximum distance a geolocation point can be from the given point

public Query nearSphere (String field, double lat, double lon)

Used on Geospatial fields to return all points near a given point.

Parameters
field The geolocation field to filter on
lat latitude
lon longitude
Returns
  • Query object

public Query not ()

Negates the current query's comparison operators

Returns
  • Query object

public Query notEqual (String key, Object value)

Add a filter condition for a specific field being not equal to a value

Parameters
key Field to filter on
value Value condition for filter
Returns
  • Query object

public Query notIn (String key, Object[] value)

Add a filter condition for a specific field being not in an array of values

Parameters
key Field to filter on
value An array of values
Returns
  • Query object

public Query or (AbstractQuery query)

Joins a second Query filter to the current query object and connects them with a logical OR

Parameters
query The query which contains the QueryFilter to be joined
Returns
  • Query object

public Query regEx (String key, Object value)

Add a filter condition for a specific field compared to a regular expression

Parameters
key Field to filter on
value Value condition for filter
Returns
  • Query object

public Query setLimit (int limit)

Sets the maximum number of records to return

Parameters
limit The maximum number of records to return
Returns
  • Query

public Query setSkip (int skip)

Sets the number of records to skip before returning the results (useful for pagination).

Returns
  • Query object

public Query size (String key, int value)

Add a filter for any array that is of the given size

Parameters
key Field to filter on
value The expected size of the array
Returns
  • Query object

public Query startsWith (String key, Object value)

Add a filter condition for a specific field for strings that start with the given value.

Parameters
key Field to filter on
value Value condition for filter
Returns
  • Query object

public AbstractQuery withinBox (String field, double pointOneLat, double pointOneLon, double pointTwoLat, double pointTwoLon)

public AbstractQuery withinPolygon (String field, double pointOneLat, double pointOneLon, double pointTwoLat, double pointTwoLon, double pointThreeLat, double pointThreeLon, double pointFourLat, double pointFourLon)