PFQuery Class Reference
| Inherits from | NSObject |
| Declared in | PFQuery.h |
Tasks
Creating a Query for a Class
-
+ queryWithClassName:Returns a PFQuery for a given class.
-
+ queryWithClassName:predicate:Creates a PFQuery with the constraints given by predicate.
-
– initWithClassName:Initializes the query with a class name.
-
parseClassNameThe class name to query for
property
Adding Basic Constraints
-
– includeKey:Make the query include PFObjects that have a reference stored at the provided key.
This has an effect similar to a join. You can use dot notation to specify which fields in
the included object are also fetch. -
– whereKeyExists:Add a constraint that requires a particular key exists.
-
– whereKeyDoesNotExist:Add a constraint that requires a key not exist.
-
– whereKey:equalTo:Add a constraint to the query that requires a particular key’s object to be equal to the provided object.
-
– whereKey:lessThan:Add a constraint to the query that requires a particular key’s object to be less than the provided object.
-
– whereKey:lessThanOrEqualTo:Add a constraint to the query that requires a particular key’s object to be less than or equal to the provided object.
-
– whereKey:greaterThan:Add a constraint to the query that requires a particular key’s object to be greater than the provided object.
-
– whereKey:greaterThanOrEqualTo:Add a constraint to the query that requires a particular key’s object to be greater than or equal to the provided object.
-
– whereKey:notEqualTo:Add a constraint to the query that requires a particular key’s object to be not equal to the provided object.
-
– whereKey:containedIn:Add a constraint to the query that requires a particular key’s object to be contained in the provided array.
-
– whereKey:notContainedIn:Add a constraint to the query that requires a particular key’s object not be contained in the provided array.
-
– whereKey:containsAllObjectsInArray:Add a constraint to the query that requires a particular key’s array contains every element of the provided array.
Adding Location Constraints
-
– whereKey:nearGeoPoint:Add a constraint to the query that requires a particular key’s coordinates (specified via PFGeoPoint) be near
a reference point. Distance is calculated based on angular distance on a sphere. Results will be sorted by distance
from reference point. -
– whereKey:nearGeoPoint:withinMiles:Add a constraint to the query that requires a particular key’s coordinates (specified via PFGeoPoint) be near
a reference point and within the maximum distance specified (in miles). Distance is calculated based on
a spherical coordinate system. Results will be sorted by distance (nearest to farthest) from the reference point. -
– whereKey:nearGeoPoint:withinKilometers:Add a constraint to the query that requires a particular key’s coordinates (specified via PFGeoPoint) be near
a reference point and within the maximum distance specified (in kilometers). Distance is calculated based on
a spherical coordinate system. Results will be sorted by distance (nearest to farthest) from the reference point. -
– whereKey:nearGeoPoint:withinRadians:Add a constraint to the query that requires a particular key’s coordinates (specified via PFGeoPoint) be near
a reference point and within the maximum distance specified (in radians). Distance is calculated based on
angular distance on a sphere. Results will be sorted by distance (nearest to farthest) from the reference point. -
– whereKey:withinGeoBoxFromSouthwest:toNortheast:Add a constraint to the query that requires a particular key’s coordinates (specified via PFGeoPoint) be
contained within a given rectangular geographic bounding box.
Adding String Constraints
-
– whereKey:matchesRegex:Add a regular expression constraint for finding string values that match the provided regular expression.
This may be slow for large datasets. -
– whereKey:matchesRegex:modifiers:Add a regular expression constraint for finding string values that match the provided regular expression.
This may be slow for large datasets. -
– whereKey:containsString:Add a constraint for finding string values that contain a provided substring.
This will be slow for large datasets. -
– whereKey:hasPrefix:Add a constraint for finding string values that start with a provided prefix.
This will use smart indexing, so it will be fast for large datasets. -
– whereKey:hasSuffix:Add a constraint for finding string values that end with a provided suffix.
This will be slow for large datasets.
Adding Subqueries
-
+ orQueryWithSubqueries:Returns a PFQuery that is the or of the passed in PFQuerys.
-
– whereKey:matchesKey:inQuery:Adds a constraint that requires that a key’s value matches a value in another key
in objects returned by a sub query. -
– whereKey:doesNotMatchKey:inQuery:Adds a constraint that requires that a key’s value NOT match a value in another key
in objects returned by a sub query. -
– whereKey:matchesQuery:Add a constraint that requires that a key’s value matches a PFQuery constraint.
This only works where the key’s values are PFObjects or arrays of PFObjects. -
– whereKey:doesNotMatchQuery:Add a constraint that requires that a key’s value to not match a PFQuery constraint.
This only works where the key’s values are PFObjects or arrays of PFObjects.
Sorting
-
– orderByAscending:Sort the results in ascending order with the given key.
-
– addAscendingOrder:Also sort in ascending order by the given key. The previous keys provided will
precedence over this key. -
– orderByDescending:Sort the results in descending order with the given key.
-
– addDescendingOrder:Also sort in descending order by the given key. The previous keys provided will
precedence over this key. -
– orderBySortDescriptor:Sort the results in descending order with the given descriptor.
-
– orderBySortDescriptors:Sort the results in descending order with the given descriptors.
Getting Objects by ID
-
+ getObjectOfClass:objectId:Returns a PFObject with a given class and id.
-
+ getObjectOfClass:objectId:error:Returns a PFObject with a given class and id and sets an error if necessary.
-
– getObjectWithId:Returns a PFObject with the given id.
-
– getObjectWithId:error:Returns a PFObject with the given id and sets an error if necessary.
-
– getObjectInBackgroundWithId:block:Gets a PFObject asynchronously and calls the given block with the result.
-
– getObjectInBackgroundWithId:target:selector:Gets a PFObject asynchronously.
Getting User Objects
-
+ getUserObjectWithId:Returns a PFUser with a given id.
-
+ getUserObjectWithId:error:Returns a PFUser with a given class and id and sets an error if necessary.
-
+ queryForUserDeprecated. Please use [PFUser query] instead.
Getting all Matches for a Query
-
– findObjectsFinds objects based on the constructed query.
-
– findObjects:Finds objects based on the constructed query and sets an error if there was one.
-
– findObjectsInBackgroundWithBlock:Finds objects asynchronously and calls the given block with the results.
-
– findObjectsInBackgroundWithTarget:selector:Finds objects asynchronously and calls the given callback with the results.
Getting the First Match in a Query
-
– getFirstObjectGets an object based on the constructed query.
-
– getFirstObject:Gets an object based on the constructed query and sets an error if any occurred.
-
– getFirstObjectInBackgroundWithBlock:Gets an object asynchronously and calls the given block with the result.
-
– getFirstObjectInBackgroundWithTarget:selector:Gets an object asynchronously and calls the given callback with the results.
Counting the Matches in a Query
-
– countObjectsCounts objects based on the constructed query.
-
– countObjects:Counts objects based on the constructed query and sets an error if there was one.
-
– countObjectsInBackgroundWithBlock:Counts objects asynchronously and calls the given block with the counts.
-
– countObjectsInBackgroundWithTarget:selector:Counts objects asynchronously and calls the given callback with the count.
Cancelling a Query
-
– cancelCancels the current network request (if any). Ensures that callbacks won’t be called.
Paginating Results
-
limitA limit on the number of objects to return. The default limit is 100, with a
property
maximum of 1000 results being returned at a time. -
skipThe number of objects to skip before returning any.
property
Controlling Caching Behavior
-
cachePolicyThe cache policy to use for requests.
property -
– hasCachedResultReturns whether there is a cached result for this query.
-
– clearCachedResultClears the cached result for this query. If there is no cached result, this is a noop.
-
+ clearAllCachedResultsClears the cached results for all queries.
Advanced Settings
-
traceWhether or not performance tracing should be done on the query.
property
This should not be set in most cases.
Properties
cachePolicy
The cache policy to use for requests.
@property (readwrite, assign) PFCachePolicy cachePolicyDiscussion
The cache policy to use for requests.
Declared In
PFQuery.hlimit
A limit on the number of objects to return. The default limit is 100, with a
maximum of 1000 results being returned at a time.
@property (nonatomic) NSInteger limitDiscussion
A limit on the number of objects to return. The default limit is 100, with a
maximum of 1000 results being returned at a time.
Note: If you are calling findObject with limit=1, you may find it easier to use getFirst instead.
Declared In
PFQuery.hparseClassName
The class name to query for
@property (nonatomic, retain) NSString *parseClassNameDiscussion
The class name to query for
Declared In
PFQuery.hClass Methods
clearAllCachedResults
Clears the cached results for all queries.
+ (void)clearAllCachedResultsDiscussion
Clears the cached results for all queries.
Declared In
PFQuery.hgetObjectOfClass:objectId:
Returns a PFObject with a given class and id.
+ (PFObject *)getObjectOfClass:(NSString *)objectClass objectId:(NSString *)objectIdParameters
- objectClass
The class name for the object that is being requested.
- objectId
The id of the object that is being requested.
Return Value
The PFObject if found. Returns nil if the object isn’t found, or if there was an error.
Discussion
Returns a PFObject with a given class and id.
Declared In
PFQuery.hgetObjectOfClass:objectId:error:
Returns a PFObject with a given class and id and sets an error if necessary.
+ (PFObject *)getObjectOfClass:(NSString *)objectClass objectId:(NSString *)objectId error:(NSError **)errorParameters
- error
Pointer to an NSError that will be set if necessary.
Return Value
The PFObject if found. Returns nil if the object isn’t found, or if there was an error.
Discussion
Returns a PFObject with a given class and id and sets an error if necessary.
Declared In
PFQuery.hgetUserObjectWithId:
Returns a PFUser with a given id.
+ (PFUser *)getUserObjectWithId:(NSString *)objectIdParameters
- objectId
The id of the object that is being requested.
Return Value
The PFUser if found. Returns nil if the object isn’t found, or if there was an error.
Discussion
Returns a PFUser with a given id.
Declared In
PFQuery.hgetUserObjectWithId:error:
Returns a PFUser with a given class and id and sets an error if necessary.
+ (PFUser *)getUserObjectWithId:(NSString *)objectId error:(NSError **)errorParameters
- error
Pointer to an NSError that will be set if necessary.
Return Value
The PFUser if found. Returns nil if the object isn’t found, or if there was an error.
Discussion
Returns a PFUser with a given class and id and sets an error if necessary.
Declared In
PFQuery.horQueryWithSubqueries:
Returns a PFQuery that is the or of the passed in PFQuerys.
+ (PFQuery *)orQueryWithSubqueries:(NSArray *)queriesParameters
- queries
The list of queries to or together.
Return Value
a PFQuery that is the or of the passed in PFQuerys.
Discussion
Returns a PFQuery that is the or of the passed in PFQuerys.
Declared In
PFQuery.hqueryForUser
Deprecated. Please use [PFUser query] instead.
+ (PFQuery *)queryForUserDiscussion
Deprecated. Please use [PFUser query] instead.
Declared In
PFQuery.hqueryWithClassName:
Returns a PFQuery for a given class.
+ (PFQuery *)queryWithClassName:(NSString *)classNameParameters
- className
The class to query on.
Return Value
A PFQuery object.
Discussion
Returns a PFQuery for a given class.
Declared In
PFQuery.hqueryWithClassName:predicate:
Creates a PFQuery with the constraints given by predicate.
+ (PFQuery *)queryWithClassName:(NSString *)className predicate:(NSPredicate *)predicateDiscussion
Creates a PFQuery with the constraints given by predicate.
The following types of predicates are supported:
* Simple comparisons such as =, !=, <, >, <=, >=, and BETWEEN with a key and a constant.
* Containment predicates, such as “x IN {1, 2, 3}”.
* Key-existence predicates, such as “x IN SELF”.
* BEGINSWITH expressions.
* Compound predicates with AND, OR, and NOT.
* SubQueries with “key IN %@”, subquery.
The following types of predicates are NOT supported:
* Aggregate operations, such as ANY, SOME, ALL, or NONE.
* Regular expressions, such as LIKE, MATCHES, CONTAINS, or ENDSWITH.
* Predicates comparing one key to another.
* Complex predicates with many ORed clauses.
Declared In
PFQuery.hInstance Methods
addAscendingOrder:
Also sort in ascending order by the given key. The previous keys provided will
precedence over this key.
- (void)addAscendingOrder:(NSString *)keyParameters
- key
The key to order bye
Discussion
Also sort in ascending order by the given key. The previous keys provided will
precedence over this key.
Declared In
PFQuery.haddDescendingOrder:
Also sort in descending order by the given key. The previous keys provided will
precedence over this key.
- (void)addDescendingOrder:(NSString *)keyParameters
- key
The key to order bye
Discussion
Also sort in descending order by the given key. The previous keys provided will
precedence over this key.
Declared In
PFQuery.hcancel
Cancels the current network request (if any). Ensures that callbacks won’t be called.
- (void)cancelDiscussion
Cancels the current network request (if any). Ensures that callbacks won’t be called.
Declared In
PFQuery.hclearCachedResult
Clears the cached result for this query. If there is no cached result, this is a noop.
- (void)clearCachedResultDiscussion
Clears the cached result for this query. If there is no cached result, this is a noop.
Declared In
PFQuery.hcountObjects
Counts objects based on the constructed query.
- (NSInteger)countObjectsReturn Value
Returns the number of PFObjects that match the query, or -1 if there is an error.
Discussion
Counts objects based on the constructed query.
Declared In
PFQuery.hcountObjects:
Counts objects based on the constructed query and sets an error if there was one.
- (NSInteger)countObjects:(NSError **)errorParameters
- error
Pointer to an NSError that will be set if necessary.
Return Value
Returns the number of PFObjects that match the query, or -1 if there is an error.
Discussion
Counts objects based on the constructed query and sets an error if there was one.
Declared In
PFQuery.hcountObjectsInBackgroundWithBlock:
Counts objects asynchronously and calls the given block with the counts.
- (void)countObjectsInBackgroundWithBlock:(PFIntegerResultBlock)blockParameters
- block
The block to execute. The block should have the following argument signature:
(int count, NSError *error)
Discussion
Counts objects asynchronously and calls the given block with the counts.
Declared In
PFQuery.hcountObjectsInBackgroundWithTarget:selector:
Counts objects asynchronously and calls the given callback with the count.
- (void)countObjectsInBackgroundWithTarget:(id)target selector:(SEL)selectorParameters
- target
The object to call the selector on.
- selector
The selector to call. It should have the following signature: (void)callbackWithResult:(NSNumber )result error:(NSError )error.
Discussion
Counts objects asynchronously and calls the given callback with the count.
Declared In
PFQuery.hfindObjects
Finds objects based on the constructed query.
- (NSArray *)findObjectsReturn Value
Returns an array of PFObjects that were found.
Discussion
Finds objects based on the constructed query.
Declared In
PFQuery.hfindObjects:
Finds objects based on the constructed query and sets an error if there was one.
- (NSArray *)findObjects:(NSError **)errorParameters
- error
Pointer to an NSError that will be set if necessary.
Return Value
Returns an array of PFObjects that were found.
Discussion
Finds objects based on the constructed query and sets an error if there was one.
Declared In
PFQuery.hfindObjectsInBackgroundWithBlock:
Finds objects asynchronously and calls the given block with the results.
- (void)findObjectsInBackgroundWithBlock:(PFArrayResultBlock)blockParameters
- block
The block to execute. The block should have the following argument signature:(NSArray objects, NSError error)
Discussion
Finds objects asynchronously and calls the given block with the results.
Declared In
PFQuery.hfindObjectsInBackgroundWithTarget:selector:
Finds objects asynchronously and calls the given callback with the results.
- (void)findObjectsInBackgroundWithTarget:(id)target selector:(SEL)selectorParameters
- target
The object to call the selector on.
- selector
The selector to call. It should have the following signature: (void)callbackWithResult:(NSArray )result error:(NSError )error. result will be nil if error is set and vice versa.
Discussion
Finds objects asynchronously and calls the given callback with the results.
Declared In
PFQuery.hgetFirstObject
Gets an object based on the constructed query.
- (PFObject *)getFirstObjectReturn Value
Returns a PFObject, or nil if none was found.
Discussion
Gets an object based on the constructed query.
This mutates the PFQuery.
Declared In
PFQuery.hgetFirstObject:
Gets an object based on the constructed query and sets an error if any occurred.
- (PFObject *)getFirstObject:(NSError **)errorParameters
- error
Pointer to an NSError that will be set if necessary.
Return Value
Returns a PFObject, or nil if none was found.
Discussion
Gets an object based on the constructed query and sets an error if any occurred.
This mutates the PFQuery.
Declared In
PFQuery.hgetFirstObjectInBackgroundWithBlock:
Gets an object asynchronously and calls the given block with the result.
- (void)getFirstObjectInBackgroundWithBlock:(PFObjectResultBlock)blockParameters
- block
The block to execute. The block should have the following argument signature:(PFObject object, NSError error) result will be nil if error is set OR no object was found matching the query. error will be nil if result is set OR if the query succeeded, but found no results.
Discussion
Gets an object asynchronously and calls the given block with the result.
This mutates the PFQuery.
Declared In
PFQuery.hgetFirstObjectInBackgroundWithTarget:selector:
Gets an object asynchronously and calls the given callback with the results.
- (void)getFirstObjectInBackgroundWithTarget:(id)target selector:(SEL)selectorParameters
- target
The object to call the selector on.
- selector
The selector to call. It should have the following signature: (void)callbackWithResult:(PFObject )result error:(NSError )error. result will be nil if error is set OR no object was found matching the query. error will be nil if result is set OR if the query succeeded, but found no results.
Discussion
Gets an object asynchronously and calls the given callback with the results.
This mutates the PFQuery.
Declared In
PFQuery.hgetObjectInBackgroundWithId:block:
Gets a PFObject asynchronously and calls the given block with the result.
- (void)getObjectInBackgroundWithId:(NSString *)objectId block:(PFObjectResultBlock)blockParameters
- block
The block to execute. The block should have the following argument signature: (NSArray object, NSError error)
Discussion
Gets a PFObject asynchronously and calls the given block with the result.
This mutates the PFQuery
Declared In
PFQuery.hgetObjectInBackgroundWithId:target:selector:
Gets a PFObject asynchronously.
- (void)getObjectInBackgroundWithId:(NSString *)objectId target:(id)target selector:(SEL)selectorParameters
- objectId
The id of the object being requested.
- target
The target for the callback selector.
- selector
The selector for the callback. It should have the following signature: (void)callbackWithResult:(PFObject )result error:(NSError )error. result will be nil if error is set and vice versa.
Declared In
PFQuery.hgetObjectWithId:
Returns a PFObject with the given id.
- (PFObject *)getObjectWithId:(NSString *)objectIdParameters
- objectId
The id of the object that is being requested.
Return Value
The PFObject if found. Returns nil if the object isn’t found, or if there was an error.
Declared In
PFQuery.hgetObjectWithId:error:
Returns a PFObject with the given id and sets an error if necessary.
- (PFObject *)getObjectWithId:(NSString *)objectId error:(NSError **)errorParameters
- error
Pointer to an NSError that will be set if necessary.
Return Value
The PFObject if found. Returns nil if the object isn’t found, or if there was an error.
Discussion
Returns a PFObject with the given id and sets an error if necessary.
This mutates the PFQuery
Declared In
PFQuery.hhasCachedResult
Returns whether there is a cached result for this query.
- (BOOL)hasCachedResultReturn Value
YES if there is a cached result for this query, and NO otherwise.
Discussion
Returns whether there is a cached result for this query.
Declared In
PFQuery.hincludeKey:
Make the query include PFObjects that have a reference stored at the provided key.
This has an effect similar to a join. You can use dot notation to specify which fields in
the included object are also fetch.
- (void)includeKey:(NSString *)keyParameters
- key
The key to load child PFObjects for.
Discussion
Make the query include PFObjects that have a reference stored at the provided key.
This has an effect similar to a join. You can use dot notation to specify which fields in
the included object are also fetch.
Declared In
PFQuery.hinitWithClassName:
Initializes the query with a class name.
- (id)initWithClassName:(NSString *)newClassNameParameters
- newClassName
The class name.
Discussion
Initializes the query with a class name.
Declared In
PFQuery.horderByAscending:
Sort the results in ascending order with the given key.
- (void)orderByAscending:(NSString *)keyParameters
- key
The key to order by.
Discussion
Sort the results in ascending order with the given key.
Declared In
PFQuery.horderByDescending:
Sort the results in descending order with the given key.
- (void)orderByDescending:(NSString *)keyParameters
- key
The key to order by.
Discussion
Sort the results in descending order with the given key.
Declared In
PFQuery.horderBySortDescriptor:
Sort the results in descending order with the given descriptor.
- (void)orderBySortDescriptor:(NSSortDescriptor *)sortDescriptorParameters
- sortDescriptor
The NSSortDescriptor to order by.
Discussion
Sort the results in descending order with the given descriptor.
Declared In
PFQuery.horderBySortDescriptors:
Sort the results in descending order with the given descriptors.
- (void)orderBySortDescriptors:(NSArray *)sortDescriptorsParameters
- sortDescriptors
An NSArray of NSSortDescriptor instances to order by.
Discussion
Sort the results in descending order with the given descriptors.
Declared In
PFQuery.hwhereKey:containedIn:
Add a constraint to the query that requires a particular key’s object to be contained in the provided array.
- (void)whereKey:(NSString *)key containedIn:(NSArray *)arrayParameters
- key
The key to be constrained.
- array
The possible values for the key’s object.
Discussion
Add a constraint to the query that requires a particular key’s object to be contained in the provided array.
Declared In
PFQuery.hwhereKey:containsAllObjectsInArray:
Add a constraint to the query that requires a particular key’s array contains every element of the provided array.
- (void)whereKey:(NSString *)key containsAllObjectsInArray:(NSArray *)arrayParameters
- array
The array of values to search for.
- arrayKey
The key to be constrained.
Discussion
Add a constraint to the query that requires a particular key’s array contains every element of the provided array.
Declared In
PFQuery.hwhereKey:containsString:
Add a constraint for finding string values that contain a provided substring.
This will be slow for large datasets.
- (void)whereKey:(NSString *)key containsString:(NSString *)substringParameters
- key
The key that the string to match is stored in.
- substring
The substring that the value must contain.
Discussion
Add a constraint for finding string values that contain a provided substring.
This will be slow for large datasets.
Declared In
PFQuery.hwhereKey:doesNotMatchKey:inQuery:
Adds a constraint that requires that a key’s value NOT match a value in another key
in objects returned by a sub query.
- (void)whereKey:(NSString *)key doesNotMatchKey:(NSString *)otherKey inQuery:(PFQuery *)queryParameters
- key
The key that the value is stored
- otherKey
The key in objects in the returned by the sub query whose value should match
- query
The query to run.
Discussion
Adds a constraint that requires that a key’s value NOT match a value in another key
in objects returned by a sub query.
Declared In
PFQuery.hwhereKey:doesNotMatchQuery:
Add a constraint that requires that a key’s value to not match a PFQuery constraint.
This only works where the key’s values are PFObjects or arrays of PFObjects.
- (void)whereKey:(NSString *)key doesNotMatchQuery:(PFQuery *)queryParameters
- key
The key that the value is stored in
- query
The query the value should not match
Discussion
Add a constraint that requires that a key’s value to not match a PFQuery constraint.
This only works where the key’s values are PFObjects or arrays of PFObjects.
Declared In
PFQuery.hwhereKey:equalTo:
Add a constraint to the query that requires a particular key’s object to be equal to the provided object.
- (void)whereKey:(NSString *)key equalTo:(id)objectParameters
- key
The key to be constrained.
- object
The object that must be equalled.
Discussion
Add a constraint to the query that requires a particular key’s object to be equal to the provided object.
Declared In
PFQuery.hwhereKey:greaterThan:
Add a constraint to the query that requires a particular key’s object to be greater than the provided object.
- (void)whereKey:(NSString *)key greaterThan:(id)objectParameters
- key
The key to be constrained.
- object
The object that must be equalled.
Discussion
Add a constraint to the query that requires a particular key’s object to be greater than the provided object.
Declared In
PFQuery.hwhereKey:greaterThanOrEqualTo:
Add a constraint to the query that requires a particular key’s object to be greater than or equal to the provided object.
- (void)whereKey:(NSString *)key greaterThanOrEqualTo:(id)objectParameters
- key
The key to be constrained.
- object
The object that must be equalled.
Discussion
Add a constraint to the query that requires a particular key’s object to be greater than or equal to the provided object.
Declared In
PFQuery.hwhereKey:hasPrefix:
Add a constraint for finding string values that start with a provided prefix.
This will use smart indexing, so it will be fast for large datasets.
- (void)whereKey:(NSString *)key hasPrefix:(NSString *)prefixParameters
- key
The key that the string to match is stored in.
- prefix
The substring that the value must start with.
Discussion
Add a constraint for finding string values that start with a provided prefix.
This will use smart indexing, so it will be fast for large datasets.
Declared In
PFQuery.hwhereKey:hasSuffix:
Add a constraint for finding string values that end with a provided suffix.
This will be slow for large datasets.
- (void)whereKey:(NSString *)key hasSuffix:(NSString *)suffixParameters
- key
The key that the string to match is stored in.
- suffix
The substring that the value must end with.
Discussion
Add a constraint for finding string values that end with a provided suffix.
This will be slow for large datasets.
Declared In
PFQuery.hwhereKey:lessThan:
Add a constraint to the query that requires a particular key’s object to be less than the provided object.
- (void)whereKey:(NSString *)key lessThan:(id)objectParameters
- key
The key to be constrained.
- object
The object that provides an upper bound.
Discussion
Add a constraint to the query that requires a particular key’s object to be less than the provided object.
Declared In
PFQuery.hwhereKey:lessThanOrEqualTo:
Add a constraint to the query that requires a particular key’s object to be less than or equal to the provided object.
- (void)whereKey:(NSString *)key lessThanOrEqualTo:(id)objectParameters
- key
The key to be constrained.
- object
The object that must be equalled.
Discussion
Add a constraint to the query that requires a particular key’s object to be less than or equal to the provided object.
Declared In
PFQuery.hwhereKey:matchesKey:inQuery:
Adds a constraint that requires that a key’s value matches a value in another key
in objects returned by a sub query.
- (void)whereKey:(NSString *)key matchesKey:(NSString *)otherKey inQuery:(PFQuery *)queryParameters
- key
The key that the value is stored
- otherKey
The key in objects in the returned by the sub query whose value should match
- query
The query to run.
Discussion
Adds a constraint that requires that a key’s value matches a value in another key
in objects returned by a sub query.
Declared In
PFQuery.hwhereKey:matchesQuery:
Add a constraint that requires that a key’s value matches a PFQuery constraint.
This only works where the key’s values are PFObjects or arrays of PFObjects.
- (void)whereKey:(NSString *)key matchesQuery:(PFQuery *)queryParameters
- key
The key that the value is stored in
- query
The query the value should match
Discussion
Add a constraint that requires that a key’s value matches a PFQuery constraint.
This only works where the key’s values are PFObjects or arrays of PFObjects.
Declared In
PFQuery.hwhereKey:matchesRegex:
Add a regular expression constraint for finding string values that match the provided regular expression.
This may be slow for large datasets.
- (void)whereKey:(NSString *)key matchesRegex:(NSString *)regexParameters
- key
The key that the string to match is stored in.
- regex
The regular expression pattern to match.
Discussion
Add a regular expression constraint for finding string values that match the provided regular expression.
This may be slow for large datasets.
Declared In
PFQuery.hwhereKey:matchesRegex:modifiers:
Add a regular expression constraint for finding string values that match the provided regular expression.
This may be slow for large datasets.
- (void)whereKey:(NSString *)key matchesRegex:(NSString *)regex modifiers:(NSString *)modifiersParameters
- key
The key that the string to match is stored in.
- regex
The regular expression pattern to match.
- modifiers
Any of the following supported PCRE modifiers:
i- Case insensitive searchm- Search across multiple lines of input
Discussion
Add a regular expression constraint for finding string values that match the provided regular expression.
This may be slow for large datasets.
Declared In
PFQuery.hwhereKey:nearGeoPoint:
Add a constraint to the query that requires a particular key’s coordinates (specified via PFGeoPoint) be near
a reference point. Distance is calculated based on angular distance on a sphere. Results will be sorted by distance
from reference point.
- (void)whereKey:(NSString *)key nearGeoPoint:(PFGeoPoint *)geopointDiscussion
Add a constraint to the query that requires a particular key’s coordinates (specified via PFGeoPoint) be near
a reference point. Distance is calculated based on angular distance on a sphere. Results will be sorted by distance
from reference point.
Declared In
PFQuery.hwhereKey:nearGeoPoint:withinKilometers:
Add a constraint to the query that requires a particular key’s coordinates (specified via PFGeoPoint) be near
a reference point and within the maximum distance specified (in kilometers). Distance is calculated based on
a spherical coordinate system. Results will be sorted by distance (nearest to farthest) from the reference point.
- (void)whereKey:(NSString *)key nearGeoPoint:(PFGeoPoint *)geopoint withinKilometers:(double)maxDistanceParameters
- key
The key to be constrained.
- geopoint
The reference point. A PFGeoPoint.
- maxDistance
Maximum distance in kilometers.
Discussion
Add a constraint to the query that requires a particular key’s coordinates (specified via PFGeoPoint) be near
a reference point and within the maximum distance specified (in kilometers). Distance is calculated based on
a spherical coordinate system. Results will be sorted by distance (nearest to farthest) from the reference point.
Declared In
PFQuery.hwhereKey:nearGeoPoint:withinMiles:
Add a constraint to the query that requires a particular key’s coordinates (specified via PFGeoPoint) be near
a reference point and within the maximum distance specified (in miles). Distance is calculated based on
a spherical coordinate system. Results will be sorted by distance (nearest to farthest) from the reference point.
- (void)whereKey:(NSString *)key nearGeoPoint:(PFGeoPoint *)geopoint withinMiles:(double)maxDistanceParameters
- key
The key to be constrained.
- geopoint
The reference point. A PFGeoPoint.
- maxDistance
Maximum distance in miles.
Discussion
Add a constraint to the query that requires a particular key’s coordinates (specified via PFGeoPoint) be near
a reference point and within the maximum distance specified (in miles). Distance is calculated based on
a spherical coordinate system. Results will be sorted by distance (nearest to farthest) from the reference point.
Declared In
PFQuery.hwhereKey:nearGeoPoint:withinRadians:
Add a constraint to the query that requires a particular key’s coordinates (specified via PFGeoPoint) be near
a reference point and within the maximum distance specified (in radians). Distance is calculated based on
angular distance on a sphere. Results will be sorted by distance (nearest to farthest) from the reference point.
- (void)whereKey:(NSString *)key nearGeoPoint:(PFGeoPoint *)geopoint withinRadians:(double)maxDistanceParameters
- key
The key to be constrained.
- geopoint
The reference point. A PFGeoPoint.
- maxDistance
Maximum distance in radians.
Discussion
Add a constraint to the query that requires a particular key’s coordinates (specified via PFGeoPoint) be near
a reference point and within the maximum distance specified (in radians). Distance is calculated based on
angular distance on a sphere. Results will be sorted by distance (nearest to farthest) from the reference point.
Declared In
PFQuery.hwhereKey:notContainedIn:
Add a constraint to the query that requires a particular key’s object not be contained in the provided array.
- (void)whereKey:(NSString *)key notContainedIn:(NSArray *)arrayParameters
- key
The key to be constrained.
- array
The list of values the key’s object should not be.
Discussion
Add a constraint to the query that requires a particular key’s object not be contained in the provided array.
Declared In
PFQuery.hwhereKey:notEqualTo:
Add a constraint to the query that requires a particular key’s object to be not equal to the provided object.
- (void)whereKey:(NSString *)key notEqualTo:(id)objectParameters
- key
The key to be constrained.
- object
The object that must not be equalled.
Discussion
Add a constraint to the query that requires a particular key’s object to be not equal to the provided object.
Declared In
PFQuery.hwhereKey:withinGeoBoxFromSouthwest:toNortheast:
Add a constraint to the query that requires a particular key’s coordinates (specified via PFGeoPoint) be
contained within a given rectangular geographic bounding box.
- (void)whereKey:(NSString *)key withinGeoBoxFromSouthwest:(PFGeoPoint *)southwest toNortheast:(PFGeoPoint *)northeastParameters
- key
The key to be constrained.
- southwest
The lower-left inclusive corner of the box.
- northeast
The upper-right inclusive corner of the box.
Discussion
Add a constraint to the query that requires a particular key’s coordinates (specified via PFGeoPoint) be
contained within a given rectangular geographic bounding box.
Declared In
PFQuery.h