ParseQuery

Parse~ ParseQuery

Creates a new parse Parse.Query for the given Parse.Object subclass.

Parse.Query defines a query that is used to fetch Parse.Objects. The most common use case is finding all objects that match a query through the find method. for example, this sample code fetches all objects of class myclass. it calls a different function depending on whether the fetch succeeded or not.

var query = new Parse.Query(myclass);
query.find().then((results) => {
  // results is an array of parse.object.
}).catch((error) =>  {
 // error is an instance of parse.error.
});

a Parse.Query can also be used to retrieve a single object whose id is known, through the get method. for example, this sample code fetches an object of class myclass and id myid. it calls a different function depending on whether the fetch succeeded or not.

var query = new Parse.Query(myclass);
query.get(myid).then((object) => {
    // object is an instance of parse.object.
}).catch((error) =>  {
 // error is an instance of parse.error.
});

a Parse.Query can also be used to count the number of objects that match the query without retrieving all of those objects. for example, this sample code counts the number of objects of the class myclass

var query = new Parse.Query(myclass);
query.count().then((number) => {
    // there are number instances of myclass.
}).catch((error) => {
    // error is an instance of Parse.Error.
});

Constructor

new ParseQuery(objectClass)

Parameters:
Name Type Description
objectClass string | Parse.Object

An instance of a subclass of Parse.Object, or a Parse className string.

Methods

(static) and(…queries) → {Parse.Query}

Constructs a Parse.Query that is the AND of the passed in queries. For example:

var compoundQuery = Parse.Query.and(query1, query2, query3);

will create a compoundQuery that is an and of the query1, query2, and query3.

Parameters:
Name Type Attributes Description
queries Parse.Query <repeatable>

The list of queries to AND.

Returns:
Type:
Parse.Query

The query that is the AND of the passed in queries.

(static) fromJSON(className, json) → {Parse.Query}

Static method to restore Parse.Query by json representation Internally calling Parse.Query.withJSON

Parameters:
Name Type Description
className string
json QueryJSON

from Parse.Query.toJSON() method

Returns:
Type:
Parse.Query

new created query

(static) nor(…queries) → {Parse.Query}

Constructs a Parse.Query that is the NOR of the passed in queries. For example:

const compoundQuery = Parse.Query.nor(query1, query2, query3);

will create a compoundQuery that is a nor of the query1, query2, and query3.

Parameters:
Name Type Attributes Description
queries Parse.Query <repeatable>

The list of queries to NOR.

Returns:
Type:
Parse.Query

The query that is the NOR of the passed in queries.

(static) or(…queries) → {Parse.Query}

Constructs a Parse.Query that is the OR of the passed in queries. For example:

var compoundQuery = Parse.Query.or(query1, query2, query3);

will create a compoundQuery that is an or of the query1, query2, and query3.

Parameters:
Name Type Attributes Description
queries Parse.Query <repeatable>

The list of queries to OR.

Returns:
Type:
Parse.Query

The query that is the OR of the passed in queries.

_addCondition(key, condition, value) → {Parse.Query}

Helper for condition queries

Parameters:
Name Type Description
key
condition
value
Returns:
Type:
Parse.Query

_andQuery(queries) → {Parse.Query}

Adds constraint that all of the passed in queries match.

Parameters:
Name Type Description
queries Array
Returns:
Type:
Parse.Query

Returns the query, so you can chain this call.

_norQuery(queries) → {Parse.Query}

Adds constraint that none of the passed in queries match.

Parameters:
Name Type Description
queries Array
Returns:
Type:
Parse.Query

Returns the query, so you can chain this call.

_orQuery(queries) → {Parse.Query}

Adds constraint that at least one of the passed in queries matches.

Parameters:
Name Type Description
queries Array
Returns:
Type:
Parse.Query

Returns the query, so you can chain this call.

_regexStartWith(string) → {string}

Converts string for regular expression at the beginning

Parameters:
Name Type Description
string
Returns:
Type:
string

addAscending(…keys) → {Parse.Query}

Sorts the results in ascending order by the given key, but can also add secondary sort descriptors without overwriting _order.

Parameters:
Name Type Attributes Description
keys string | Array.<string> <repeatable>

The key to order by, which is a string of comma separated values, or an Array of keys, or multiple keys.

Returns:
Type:
Parse.Query

Returns the query, so you can chain this call.

addDescending(…keys) → {Parse.Query}

Sorts the results in descending order by the given key, but can also add secondary sort descriptors without overwriting _order.

Parameters:
Name Type Attributes Description
keys string | Array.<string> <repeatable>

The key to order by, which is a string of comma separated values, or an Array of keys, or multiple keys.

Returns:
Type:
Parse.Query

Returns the query, so you can chain this call.

aggregate(pipeline, options) → {Promise}

Executes an aggregate query and returns aggregate results

Parameters:
Name Type Description
pipeline Array | object

Array or Object of stages to process query

options object

Valid options are:

  • sessionToken: A valid session token, used for making a request on behalf of a specific user.
Returns:
Type:
Promise

A promise that is resolved with the query completes.

ascending(…keys) → {Parse.Query}

Sorts the results in ascending order by the given key.

Parameters:
Name Type Attributes Description
keys string | Array.<string> <repeatable>

The key to order by, which is a string of comma separated values, or an Array of keys, or multiple keys.

Returns:
Type:
Parse.Query

Returns the query, so you can chain this call.

cancel() → {Parse.Query}

Cancels the current network request (if any is running).

Returns:
Type:
Parse.Query

Returns the query, so you can chain this call.

containedBy(key, values) → {Parse.Query}

Adds a constraint to the query that requires a particular key's value to be contained by the provided list of values. Get objects where all array elements match.

Parameters:
Name Type Description
key string

The key to check.

values Array

The values that will match.

Returns:
Type:
Parse.Query

Returns the query, so you can chain this call.

containedIn(key, value) → {Parse.Query}

Adds a constraint to the query that requires a particular key's value to be contained in the provided list of values.

Parameters:
Name Type Description
key string

The key to check.

value *

The values that will match.

Returns:
Type:
Parse.Query

Returns the query, so you can chain this call.

contains(key, substring) → {Parse.Query}

Adds a constraint for finding string values that contain a provided string. This may be slow for large datasets.

Parameters:
Name Type Description
key string

The key that the string to match is stored in.

substring string

The substring that the value must contain.

Returns:
Type:
Parse.Query

Returns the query, so you can chain this call.

containsAll(key, values) → {Parse.Query}

Adds a constraint to the query that requires a particular key's value to contain each one of the provided list of values.

Parameters:
Name Type Description
key string

The key to check. This key's value must be an array.

values Array

The values that will match.

Returns:
Type:
Parse.Query

Returns the query, so you can chain this call.

containsAllStartingWith(key, values) → {Parse.Query}

Adds a constraint to the query that requires a particular key's value to contain each one of the provided list of values starting with given strings.

Parameters:
Name Type Description
key string

The key to check. This key's value must be an array.

values Array.<string>

The string values that will match as starting string.

Returns:
Type:
Parse.Query

Returns the query, so you can chain this call.

count(options) → {Promise}

Counts the number of objects that match this query.

Parameters:
Name Type Description
options object

Valid options are:

  • useMasterKey: In Cloud Code and Node only, causes the Master Key to be used for this request.
  • sessionToken: A valid session token, used for making a request on behalf of a specific user.
Returns:
Type:
Promise

A promise that is resolved with the count when the query completes.

descending(…keys) → {Parse.Query}

Sorts the results in descending order by the given key.

Parameters:
Name Type Attributes Description
keys string | Array.<string> <repeatable>

The key to order by, which is a string of comma separated values, or an Array of keys, or multiple keys.

Returns:
Type:
Parse.Query

Returns the query, so you can chain this call.

distinct(key, options) → {Promise}

Executes a distinct query and returns unique values

Parameters:
Name Type Description
key string

A field to find distinct values

options object

Valid options are:

  • sessionToken: A valid session token, used for making a request on behalf of a specific user.
Returns:
Type:
Promise

A promise that is resolved with the query completes.

doesNotExist(key) → {Parse.Query}

Adds a constraint for finding objects that do not contain a given key.

Parameters:
Name Type Description
key string

The key that should not exist

Returns:
Type:
Parse.Query

Returns the query, so you can chain this call.

doesNotMatchKeyInQuery(key, queryKey, query) → {Parse.Query}

Adds a constraint that requires that a key's value not match a value in an object returned by a different Parse.Query.

Parameters:
Name Type Description
key string

The key that contains the value that is being excluded.

queryKey string

The key in the objects returned by the query to match against.

query Parse.Query

The query to run.

Returns:
Type:
Parse.Query

Returns the query, so you can chain this call.

doesNotMatchQuery(key, query) → {Parse.Query}

Adds a constraint that requires that a key's value not matches a Parse.Query constraint.

Parameters:
Name Type Description
key string

The key that the contains the object to match the query.

query Parse.Query

The query that should not match.

Returns:
Type:
Parse.Query

Returns the query, so you can chain this call.

each(callback, options) → {Promise}

Iterates over each result of a query, calling a callback for each one. If the callback returns a promise, the iteration will not continue until that promise has been fulfilled. If the callback returns a rejected promise, then iteration will stop with that error. The items are processed in an unspecified order. The query may not have any sort order, and may not use limit or skip.

Parameters:
Name Type Description
callback function

Callback that will be called with each result of the query.

options object

Valid options are:

  • useMasterKey: In Cloud Code and Node only, causes the Master Key to be used for this request.
  • sessionToken: A valid session token, used for making a request on behalf of a specific user.
Returns:
Type:
Promise

A promise that will be fulfilled once the iteration has completed.

eachBatch(callback, options) → {Promise}

Iterates over objects matching a query, calling a callback for each batch. If the callback returns a promise, the iteration will not continue until that promise has been fulfilled. If the callback returns a rejected promise, then iteration will stop with that error. The items are processed in an unspecified order. The query may not have any sort order, and may not use limit or skip.

Parameters:
Name Type Description
callback function

Callback that will be called with each result of the query.

options object

Valid options are:

  • batchSize: How many objects to yield in each batch (default: 100)
  • useMasterKey: In Cloud Code and Node only, causes the Master Key to be used for this request.
  • sessionToken: A valid session token, used for making a request on behalf of a specific user.
  • context: A dictionary that is accessible in Cloud Code `beforeFind` trigger.
Returns:
Type:
Promise

A promise that will be fulfilled once the iteration has completed.

endsWith(key, suffix) → {Parse.Query}

Adds a constraint for finding string values that end with a provided string. This will be slow for large datasets.

Parameters:
Name Type Description
key string

The key that the string to match is stored in.

suffix string

The substring that the value must end with.

Returns:
Type:
Parse.Query

Returns the query, so you can chain this call.

equalTo(key, value) → {Parse.Query}

Adds a constraint to the query that requires a particular key's value to be equal to the provided value.

Parameters:
Name Type Description
key string

The key to check.

value

The value that the Parse.Object must contain.

Returns:
Type:
Parse.Query

Returns the query, so you can chain this call.

exclude(…keys) → {Parse.Query}

Restricts the fields of the returned Parse.Objects to all keys except the provided keys. Exclude takes precedence over select and include.

Requires Parse Server 3.6.0+

Parameters:
Name Type Attributes Description
keys string | Array.<string> <repeatable>

The name(s) of the key(s) to exclude.

Returns:
Type:
Parse.Query

Returns the query, so you can chain this call.

exists(key) → {Parse.Query}

Adds a constraint for finding objects that contain the given key.

Parameters:
Name Type Description
key string

The key that should exist.

Returns:
Type:
Parse.Query

Returns the query, so you can chain this call.

explain(explain) → {Parse.Query}

Investigates the query execution plan. Useful for optimizing queries. (https://docs.mongodb.com/manual/reference/operator/meta/explain/)

Parameters:
Name Type Default Description
explain boolean true

Used to toggle the information on the query plan.

Returns:
Type:
Parse.Query

Returns the query, so you can chain this call.

(async) filter(callback, options) → {Promise}

Iterates over each result of a query, calling a callback for each one. If the callback returns a promise, the iteration will not continue until that promise has been fulfilled. If the callback returns a rejected promise, then iteration will stop with that error. The items are processed in an unspecified order. The query may not have any sort order, and may not use limit or skip.

Parameters:
Name Type Description
callback function

Callback

  • currentObject: The current Parse.Object being processed in the array.
  • index: The index of the current Parse.Object being processed in the array.
  • query: The query filter was called upon.
options object

Valid options are:

  • useMasterKey: In Cloud Code and Node only, causes the Master Key to be used for this request.
  • sessionToken: A valid session token, used for making a request on behalf of a specific user.
Returns:
Type:
Promise

A promise that will be fulfilled once the iteration has completed.

find(options) → {Promise}

Retrieves a list of ParseObjects that satisfy this query.

Parameters:
Name Type Description
options object

Valid options are:

  • useMasterKey: In Cloud Code and Node only, causes the Master Key to be used for this request.
  • sessionToken: A valid session token, used for making a request on behalf of a specific user.
  • context: A dictionary that is accessible in Cloud Code `beforeFind` trigger.
Returns:
Type:
Promise

A promise that is resolved with the results when the query completes.

(async) findAll(options) → {Promise}

Retrieves a complete list of ParseObjects that satisfy this query. Using eachBatch under the hood to fetch all the valid objects.

Parameters:
Name Type Description
options object

Valid options are:

  • batchSize: How many objects to yield in each batch (default: 100)
  • useMasterKey: In Cloud Code and Node only, causes the Master Key to be used for this request.
  • sessionToken: A valid session token, used for making a request on behalf of a specific user.
Returns:
Type:
Promise

A promise that is resolved with the results when the query completes.

first(options) → {Promise}

Retrieves at most one Parse.Object that satisfies this query.

Returns the object if there is one, otherwise undefined.

Parameters:
Name Type Description
options object

Valid options are:

  • useMasterKey: In Cloud Code and Node only, causes the Master Key to be used for this request.
  • sessionToken: A valid session token, used for making a request on behalf of a specific user.
  • context: A dictionary that is accessible in Cloud Code `beforeFind` trigger.
Returns:
Type:
Promise

A promise that is resolved with the object when the query completes.

fromLocalDatastore() → {Parse.Query}

Changes the source of this query to all pinned objects.

Returns:
Type:
Parse.Query

Returns the query, so you can chain this call.

fromNetwork() → {Parse.Query}

Change the source of this query to the server.

Returns:
Type:
Parse.Query

Returns the query, so you can chain this call.

fromPin() → {Parse.Query}

Changes the source of this query to the default group of pinned objects.

Returns:
Type:
Parse.Query

Returns the query, so you can chain this call.

fromPinWithName(name) → {Parse.Query}

Changes the source of this query to a specific group of pinned objects.

Parameters:
Name Type Description
name string

The name of query source.

Returns:
Type:
Parse.Query

Returns the query, so you can chain this call.

fullText(key, value, options) → {Parse.Query}

Adds a constraint for finding string values that contain a provided string. This may be slow for large datasets. Requires Parse-Server > 2.5.0

In order to sort you must use select and ascending ($score is required)

  query.fullText('field', 'term');
  query.ascending('$score');
  query.select('$score');
 

To retrieve the weight / rank

  object->get('score');
 

You can define optionals by providing an object as a third parameter

  query.fullText('field', 'term', { language: 'es', diacriticSensitive: true });
 
Parameters:
Name Type Description
key string

The key that the string to match is stored in.

value string

The string to search

options object

(Optional)

Name Type Description
language string

The language that determines the list of stop words for the search and the rules for the stemmer and tokenizer.

caseSensitive boolean

A boolean flag to enable or disable case sensitive search.

diacriticSensitive boolean

A boolean flag to enable or disable diacritic sensitive search.

Returns:
Type:
Parse.Query

Returns the query, so you can chain this call.

get(objectId, options) → {Promise}

Constructs a Parse.Object whose id is already known by fetching data from the server. Unlike the first method, it never returns undefined.

Parameters:
Name Type Description
objectId string

The id of the object to be fetched.

options object

Valid options are:

  • useMasterKey: In Cloud Code and Node only, causes the Master Key to be used for this request.
  • sessionToken: A valid session token, used for making a request on behalf of a specific user.
  • context: A dictionary that is accessible in Cloud Code `beforeFind` trigger.
Returns:
Type:
Promise

A promise that is resolved with the result when the query completes.

greaterThan(key, value) → {Parse.Query}

Adds a constraint to the query that requires a particular key's value to be greater than the provided value.

Parameters:
Name Type Description
key string

The key to check.

value

The value that provides an lower bound.

Returns:
Type:
Parse.Query

Returns the query, so you can chain this call.

greaterThanOrEqualTo(key, value) → {Parse.Query}

Adds a constraint to the query that requires a particular key's value to be greater than or equal to the provided value.

Parameters:
Name Type Description
key string

The key to check.

value *

The value that provides an lower bound.

Returns:
Type:
Parse.Query

Returns the query, so you can chain this call.

hint(value) → {Parse.Query}

Adds a hint to force index selection. (https://docs.mongodb.com/manual/reference/operator/meta/hint/)

Parameters:
Name Type Description
value string | object

String or Object of index that should be used when executing query

Returns:
Type:
Parse.Query

Returns the query, so you can chain this call.

include(…keys) → {Parse.Query}

Includes nested Parse.Objects for the provided key. You can use dot notation to specify which fields in the included object are also fetched.

You can include all nested Parse.Objects by passing in '*'. Requires Parse Server 3.0.0+

query.include('*');
Parameters:
Name Type Attributes Description
keys string | Array.<string> <repeatable>

The name(s) of the key(s) to include.

Returns:
Type:
Parse.Query

Returns the query, so you can chain this call.

includeAll() → {Parse.Query}

Includes all nested Parse.Objects.

Requires Parse Server 3.0.0+

Returns:
Type:
Parse.Query

Returns the query, so you can chain this call.

lessThan(key, value) → {Parse.Query}

Adds a constraint to the query that requires a particular key's value to be less than the provided value.

Parameters:
Name Type Description
key string

The key to check.

value

The value that provides an upper bound.

Returns:
Type:
Parse.Query

Returns the query, so you can chain this call.

lessThanOrEqualTo(key, value) → {Parse.Query}

Adds a constraint to the query that requires a particular key's value to be less than or equal to the provided value.

Parameters:
Name Type Description
key string

The key to check.

value

The value that provides an upper bound.

Returns:
Type:
Parse.Query

Returns the query, so you can chain this call.

limit(n) → {Parse.Query}

Sets the limit of the number of results to return. The default limit is 100.

Parameters:
Name Type Description
n number

the number of results to limit to.

Returns:
Type:
Parse.Query

Returns the query, so you can chain this call.

(async) map(callback, options) → {Promise}

Iterates over each result of a query, calling a callback for each one. If the callback returns a promise, the iteration will not continue until that promise has been fulfilled. If the callback returns a rejected promise, then iteration will stop with that error. The items are processed in an unspecified order. The query may not have any sort order, and may not use limit or skip.

Parameters:
Name Type Description
callback function

Callback

  • currentObject: The current Parse.Object being processed in the array.
  • index: The index of the current Parse.Object being processed in the array.
  • query: The query map was called upon.
options object

Valid options are:

  • useMasterKey: In Cloud Code and Node only, causes the Master Key to be used for this request.
  • sessionToken: A valid session token, used for making a request on behalf of a specific user.
Returns:
Type:
Promise

A promise that will be fulfilled once the iteration has completed.

matches(key, regex, modifiers) → {Parse.Query}

Adds a regular expression constraint for finding string values that match the provided regular expression. This may be slow for large datasets.

Parameters:
Name Type Description
key string

The key that the string to match is stored in.

regex RegExp

The regular expression pattern to match.

modifiers string

The regular expression mode.

Returns:
Type:
Parse.Query

Returns the query, so you can chain this call.

matchesKeyInQuery(key, queryKey, query) → {Parse.Query}

Adds a constraint that requires that a key's value matches a value in an object returned by a different Parse.Query.

Parameters:
Name Type Description
key string

The key that contains the value that is being matched.

queryKey string

The key in the objects returned by the query to match against.

query Parse.Query

The query to run.

Returns:
Type:
Parse.Query

Returns the query, so you can chain this call.

matchesQuery(key, query) → {Parse.Query}

Adds a constraint that requires that a key's value matches a Parse.Query constraint.

Parameters:
Name Type Description
key string

The key that the contains the object to match the query.

query Parse.Query

The query that should match.

Returns:
Type:
Parse.Query

Returns the query, so you can chain this call.

near(key, point) → {Parse.Query}

Adds a proximity based constraint for finding objects with key point values near the point given.

Parameters:
Name Type Description
key string

The key that the Parse.GeoPoint is stored in.

point Parse.GeoPoint

The reference Parse.GeoPoint that is used.

Returns:
Type:
Parse.Query

Returns the query, so you can chain this call.

notContainedIn(key, value) → {Parse.Query}

Adds a constraint to the query that requires a particular key's value to not be contained in the provided list of values.

Parameters:
Name Type Description
key string

The key to check.

value *

The values that will not match.

Returns:
Type:
Parse.Query

Returns the query, so you can chain this call.

notEqualTo(key, value) → {Parse.Query}

Adds a constraint to the query that requires a particular key's value to be not equal to the provided value.

Parameters:
Name Type Description
key string

The key to check.

value

The value that must not be equalled.

Returns:
Type:
Parse.Query

Returns the query, so you can chain this call.

polygonContains(key, point) → {Parse.Query}

Add a constraint to the query that requires a particular key's coordinates that contains a ParseGeoPoint

Parameters:
Name Type Description
key string

The key to be constrained.

point Parse.GeoPoint
Returns:
Type:
Parse.Query

Returns the query, so you can chain this call.

readPreference(readPreference, includeReadPreference, subqueryReadPreference) → {Parse.Query}

Changes the read preference that the backend will use when performing the query to the database.

Parameters:
Name Type Description
readPreference string

The read preference for the main query.

includeReadPreference string

The read preference for the queries to include pointers.

subqueryReadPreference string

The read preference for the sub queries.

Returns:
Type:
Parse.Query

Returns the query, so you can chain this call.

(async) reduce(callback, initialValue, options) → {Promise}

Iterates over each result of a query, calling a callback for each one. If the callback returns a promise, the iteration will not continue until that promise has been fulfilled. If the callback returns a rejected promise, then iteration will stop with that error. The items are processed in an unspecified order. The query may not have any sort order, and may not use limit or skip.

Parameters:
Name Type Description
callback function

Callback

  • accumulator: The accumulator accumulates the callback's return values. It is the accumulated value previously returned in the last invocation of the callback.
  • currentObject: The current Parse.Object being processed in the array.
  • index: The index of the current Parse.Object being processed in the array.
initialValue *

A value to use as the first argument to the first call of the callback. If no initialValue is supplied, the first object in the query will be used and skipped.

options object

Valid options are:

  • useMasterKey: In Cloud Code and Node only, causes the Master Key to be used for this request.
  • sessionToken: A valid session token, used for making a request on behalf of a specific user.
Returns:
Type:
Promise

A promise that will be fulfilled once the iteration has completed.

select(…keys) → {Parse.Query}

Restricts the fields of the returned Parse.Objects to include only the provided keys. If this is called multiple times, then all of the keys specified in each of the calls will be included.

Parameters:
Name Type Attributes Description
keys string | Array.<string> <repeatable>

The name(s) of the key(s) to include.

Returns:
Type:
Parse.Query

Returns the query, so you can chain this call.

skip(n) → {Parse.Query}

Sets the number of results to skip before returning any results. This is useful for pagination. Default is to skip zero results.

Parameters:
Name Type Description
n number

the number of results to skip.

Returns:
Type:
Parse.Query

Returns the query, so you can chain this call.

sortByTextScore() → {Parse.Query}

Method to sort the full text search by text score

Returns:
Type:
Parse.Query

Returns the query, so you can chain this call.

startsWith(key, prefix) → {Parse.Query}

Adds a constraint for finding string values that start with a provided string. This query will use the backend index, so it will be fast even for large datasets.

Parameters:
Name Type Description
key string

The key that the string to match is stored in.

prefix string

The substring that the value must start with.

Returns:
Type:
Parse.Query

Returns the query, so you can chain this call.

(async) subscribe(sessionToken) → {Promise.<LiveQuerySubscription>}

Subscribe this query to get liveQuery updates

Parameters:
Name Type Description
sessionToken string

(optional) Defaults to the currentUser

Returns:
Type:
Promise.<LiveQuerySubscription>

Returns the liveQuerySubscription, it's an event emitter which can be used to get liveQuery updates.

toJSON() → {object}

Returns a JSON representation of this query.

Returns:
Type:
object

The JSON representation of the query.

withCount(includeCount) → {Parse.Query}

Sets the flag to include with response the total number of objects satisfying this query, despite limits/skip. Might be useful for pagination. Note that result of this query will be wrapped as an object with results: holding {ParseObject} array and count: integer holding total number

Parameters:
Name Type Default Description
includeCount boolean true

false - disable, true - enable.

Returns:
Type:
Parse.Query

Returns the query, so you can chain this call.

withinGeoBox(key, southwest, northeast) → {Parse.Query}

Adds a constraint to the query that requires a particular key's coordinates be contained within a given rectangular geographic bounding box.

Parameters:
Name Type Description
key string

The key to be constrained.

southwest Parse.GeoPoint

The lower-left inclusive corner of the box.

northeast Parse.GeoPoint

The upper-right inclusive corner of the box.

Returns:
Type:
Parse.Query

Returns the query, so you can chain this call.

withinKilometers(key, point, maxDistance, sorted) → {Parse.Query}

Adds a proximity based constraint for finding objects with key point values near the point given and within the maximum distance given. Radius of earth used is 6371.0 kilometers.

Parameters:
Name Type Description
key string

The key that the Parse.GeoPoint is stored in.

point Parse.GeoPoint

The reference Parse.GeoPoint that is used.

maxDistance number

Maximum distance (in kilometers) of results to return.

sorted boolean

A Bool value that is true if results should be sorted by distance ascending, false is no sorting is required, defaults to true.

Returns:
Type:
Parse.Query

Returns the query, so you can chain this call.

withinMiles(key, point, maxDistance, sorted) → {Parse.Query}

Adds a proximity based constraint for finding objects with key point values near the point given and within the maximum distance given. Radius of earth used is 3958.8 miles.

Parameters:
Name Type Description
key string

The key that the Parse.GeoPoint is stored in.

point Parse.GeoPoint

The reference Parse.GeoPoint that is used.

maxDistance number

Maximum distance (in miles) of results to return.

sorted boolean

A Bool value that is true if results should be sorted by distance ascending, false is no sorting is required, defaults to true.

Returns:
Type:
Parse.Query

Returns the query, so you can chain this call.

withinPolygon(key, points) → {Parse.Query}

Adds a constraint to the query that requires a particular key's coordinates be contained within and on the bounds of a given polygon. Supports closed and open (last point is connected to first) paths

Polygon must have at least 3 points

Parameters:
Name Type Description
key string

The key to be constrained.

points Array

Array of Coordinates / GeoPoints

Returns:
Type:
Parse.Query

Returns the query, so you can chain this call.

withinRadians(key, point, maxDistance, sorted) → {Parse.Query}

Adds a proximity based constraint for finding objects with key point values near the point given and within the maximum distance given.

Parameters:
Name Type Description
key string

The key that the Parse.GeoPoint is stored in.

point Parse.GeoPoint

The reference Parse.GeoPoint that is used.

maxDistance number

Maximum distance (in radians) of results to return.

sorted boolean

A Bool value that is true if results should be sorted by distance ascending, false is no sorting is required, defaults to true.

Returns:
Type:
Parse.Query

Returns the query, so you can chain this call.

withJSON(json) → {Parse.Query}

Return a query with conditions from json, can be useful to send query from server side to client Not static, all query conditions was set before calling this method will be deleted. For example on the server side we have var query = new Parse.Query("className"); query.equalTo(key: value); query.limit(100); ... (others queries) Create JSON representation of Query Object var jsonFromServer = query.fromJSON();

On client side getting query: var query = new Parse.Query("className"); query.fromJSON(jsonFromServer);

and continue to query... query.skip(100).find().then(...);

Parameters:
Name Type Description
json QueryJSON

from Parse.Query.toJSON() method

Returns:
Type:
Parse.Query

Returns the query, so you can chain this call.