Query

public struct Query<T> : Encodable, Equatable where T : ParseObject
extension Query: Queryable

The Query class defines a query that is used to query for ParseObjects.

  • An enum that determines the order to sort the results based on a given key.

    See more

    Declaration

    Swift

    public enum Order : Encodable, Equatable

    Parameters

    key

    The key to order by.

  • Create an instance with a variadic amount constraints.

    Declaration

    Swift

    public init(_ constraints: QueryConstraint...)

    Parameters

    constraints

    A variadic amount of zero or more QueryConstraint‘s.

  • Create an instance with an array of constraints.

    Declaration

    Swift

    public init(_ constraints: [QueryConstraint])

    Parameters

    constraints

    An array of QueryConstraint‘s.

  • Declaration

    Swift

    public static func == (lhs: Query<T>, rhs: Query<T>) -> Bool
  • Add any amount of variadic constraints.

    Declaration

    Swift

    public func `where`(_ constraints: QueryConstraint...) -> Query<T>

    Parameters

    constraints

    A variadic amount of zero or more QueryConstraint‘s.

  • 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 find with limit = 1, you may find it easier to use first instead.

    Declaration

    Swift

    public func limit(_ value: Int) -> Query<T>

    Parameters

    value

    n number of results to limit to.

  • The number of objects to skip before returning any. This is useful for pagination. Default is to skip zero results.

    Declaration

    Swift

    public func skip(_ value: Int) -> Query<T>

    Parameters

    value

    n number of results to skip.

  • Adds a hint to force index selection.

    Declaration

    Swift

    public func hint<U>(_ value: U) -> Query<T> where U : Encodable

    Parameters

    value

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

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

    Declaration

    Swift

    public func readPreference(_ readPreference: String?,
                               includeReadPreference: String? = nil,
                               subqueryReadPreference: String? = nil) -> Query<T>

    Parameters

    readPreference

    The read preference for the main query.

    includeReadPreference

    The read preference for the queries to include pointers.

    subqueryReadPreference

    The read preference for the sub queries.

  • Make the query include ParseObjects that have a reference stored at the provided keys.

    Declaration

    Swift

    public func include(_ keys: String...) -> Query<T>

    Parameters

    keys

    A variadic list of keys to load child ParseObjects for.

  • Make the query include ParseObjects that have a reference stored at the provided keys.

    Declaration

    Swift

    public func include(_ keys: [String]) -> Query<T>

    Parameters

    keys

    An array of keys to load child ParseObjects for.

  • Includes all nested ParseObjects one level deep.

    Warning

    Requires Parse Server 3.0.0+.

    Declaration

    Swift

    public func includeAll() -> Query<T>
  • Exclude specific keys for a ParseObject. Default is to nil.

    Warning

    Requires Parse Server > 4.5.0.

    Declaration

    Swift

    public func exclude(_ keys: String...) -> Query<T>

    Parameters

    keys

    A variadic list of keys include in the result.

  • Exclude specific keys for a ParseObject. Default is to nil.

    Warning

    Requires Parse Server > 4.5.0.

    Declaration

    Swift

    public func exclude(_ keys: [String]) -> Query<T>

    Parameters

    keys

    An array of keys to exclude.

  • Make the query restrict the fields of the returned ParseObjects 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.

    Warning

    Requires Parse Server > 4.5.0.

    Declaration

    Swift

    public func select(_ keys: String...) -> Query<T>

    Parameters

    keys

    A variadic list of keys include in the result.

  • Make the query restrict the fields of the returned ParseObjects 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.

    Warning

    Requires Parse Server > 4.5.0.

    Declaration

    Swift

    public func select(_ keys: [String]) -> Query<T>

    Parameters

    keys

    An array of keys to include in the result.

  • An enum that determines the order to sort the results based on a given key.

    Declaration

    Swift

    public func order(_ keys: [Order]?) -> Query<T>

    Parameters

    keys

    An array of keys to order by.

  • A variadic list of fields to receive when receiving a ParseLiveQuery.

    Suppose the ParseObject Player contains three fields name, id and age. If you are only interested in the change of the name field, you can set query.fields to “name”. In this situation, when the change of a Player ParseObject fulfills the subscription, only the name field will be sent to the clients instead of the full Player ParseObject.

    Warning

    This is only for ParseLiveQuery.

    Declaration

    Swift

    @available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
    public func fields(_ keys: String...) -> Query<T>

    Parameters

    keys

    A variadic list of fields to receive back instead of the whole ParseObject.

  • A list of fields to receive when receiving a ParseLiveQuery.

    Suppose the ParseObject Player contains three fields name, id and age. If you are only interested in the change of the name field, you can set query.fields to “name”. In this situation, when the change of a Player ParseObject fulfills the subscription, only the name field will be sent to the clients instead of the full Player ParseObject.

    Warning

    This is only for ParseLiveQuery.

    Declaration

    Swift

    @available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
    public func fields(_ keys: [String]) -> Query<T>

    Parameters

    keys

    An array of fields to receive back instead of the whole ParseObject.

ParseLiveQuery - Subscribe

  • Registers the query for live updates, using the default subscription handler, and the default ParseLiveQuery client. Suitable for ObjectObserved as the subscription can be used as a SwiftUI publisher. Meaning it can serve indepedently as a ViewModel in MVVM.

    Declaration

    Swift

    var subscribe: Subscription<ResultType>? { get }
  • Registers the query for live updates, using the default subscription handler, and a specific ParseLiveQuery client. Suitable for ObjectObserved as the subscription can be used as a SwiftUI publisher. Meaning it can serve indepedently as a ViewModel in MVVM.

    Declaration

    Swift

    func subscribe(_ client: ParseLiveQuery) throws -> Subscription<ResultType>

    Parameters

    client

    A specific client.

    Return Value

    The subscription that has just been registered

  • Registers a query for live updates, using a custom subscription handler.

    Declaration

    Swift

    static func subscribe<T>(_ handler: T) throws -> T where T : ParseSubscription

    Parameters

    handler

    A custom subscription handler.

    Return Value

    Your subscription handler, for easy chaining.

  • Registers a query for live updates, using a custom subscription handler.

    Declaration

    Swift

    static func subscribe<T>(_ handler: T, client: ParseLiveQuery) throws -> T where T : ParseSubscription

    Parameters

    handler

    A custom subscription handler.

    client

    A specific client.

    Return Value

    Your subscription handler, for easy chaining.

  • Registers the query for live updates, using the default subscription handler, and the default ParseLiveQuery client.

    Declaration

    Swift

    var subscribeCallback: SubscriptionCallback<ResultType>? { get }
  • Registers the query for live updates, using the default subscription handler, and a specific ParseLiveQuery client.

    Declaration

    Swift

    func subscribeCallback(_ client: ParseLiveQuery) throws -> SubscriptionCallback<ResultType>

    Parameters

    client

    A specific client.

    Return Value

    The subscription that has just been registered.

ParseLiveQuery - Unsubscribe

ParseLiveQuery - Update

  • Updates an existing subscription with a new query on the default ParseLiveQuery client. Upon completing the registration, the subscribe handler will be called with the new query.

    Declaration

    Swift

    func update<T>(_ handler: T) throws where T : ParseSubscription

    Parameters

    handler

    The specific handler to update.

  • Updates an existing subscription with a new query on a specific ParseLiveQuery client. Upon completing the registration, the subscribe handler will be called with the new query.

    Declaration

    Swift

    func update<T>(_ handler: T, client: ParseLiveQuery) throws where T : ParseSubscription

    Parameters

    handler

    The specific handler to update.

    client

    A specific client.

Queryable - Combine

  • Finds objects asynchronously and publishes when complete.

    Declaration

    Swift

    func findPublisher(options: API.Options = []) -> Future<[ResultType], ParseError>

    Parameters

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    A publisher that eventually produces a single value and then finishes or fails.

  • Query plan information for finding objects asynchronously and publishes when complete.

    Note

    An explain query will have many different underlying types. Since Swift is a strongly typed language, a developer should specify the type expected to be decoded which will be different for mongoDB and PostgreSQL. One way around this is to use a type-erased wrapper such as the AnyCodable package.

    Declaration

    Swift

    func findExplainPublisher<U>(options: API.Options = []) -> Future<[U], ParseError> where U : Decodable

    Parameters

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    A publisher that eventually produces a single value and then finishes or fails.

  • Retrieves asynchronously a complete list of ParseObject‘s that satisfy this query and publishes when complete.

    Warning

    The items are processed in an unspecified order. The query may not have any sort order, and may not use limit or skip.

    Declaration

    Swift

    func findAllPublisher(batchLimit: Int? = nil,
                          options: API.Options = []) -> Future<[ResultType], ParseError>

    Parameters

    batchLimit

    The maximum number of objects to send in each batch. If the items to be batched.

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    A publisher that eventually produces a single value and then finishes or fails.

  • Gets an object asynchronously and publishes when complete.

    Declaration

    Swift

    func firstPublisher(options: API.Options = []) -> Future<ResultType, ParseError>

    Parameters

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    A publisher that eventually produces a single value and then finishes or fails.

  • Query plan information for getting an object asynchronously and publishes when complete.

    Note

    An explain query will have many different underlying types. Since Swift is a strongly typed language, a developer should specify the type expected to be decoded which will be different for mongoDB and PostgreSQL. One way around this is to use a type-erased wrapper such as the AnyCodable package.

    Declaration

    Swift

    func firstExplainPublisher<U>(options: API.Options = []) -> Future<U, ParseError> where U : Decodable

    Parameters

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    A publisher that eventually produces a single value and then finishes or fails.

  • Count objects asynchronously and publishes when complete.

    Declaration

    Swift

    func countPublisher(options: API.Options = []) -> Future<Int, ParseError>

    Parameters

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    A publisher that eventually produces a single value and then finishes or fails.

  • Query plan information for counting objects asynchronously and publishes when complete.

    Note

    An explain query will have many different underlying types. Since Swift is a strongly typed language, a developer should specify the type expected to be decoded which will be different for mongoDB and PostgreSQL. One way around this is to use a type-erased wrapper such as the AnyCodable package.

    Declaration

    Swift

    func countExplainPublisher<U>(options: API.Options = []) -> Future<U, ParseError> where U : Decodable

    Parameters

    explain

    Used to toggle the information on the query plan.

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    A publisher that eventually produces a single value and then finishes or fails.

  • Executes an aggregate query asynchronously and publishes when complete.

    Requires

    .useMasterKey has to be available.

    Declaration

    Swift

    func aggregatePublisher(_ pipeline: [[String: Encodable]],
                            options: API.Options = []) -> Future<[ResultType], ParseError>

    Parameters

    pipeline

    A pipeline of stages to process query.

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    A publisher that eventually produces a single value and then finishes or fails.

  • Query plan information for executing an aggregate query asynchronously and publishes when complete.

    Requires

    .useMasterKey has to be available.

    Note

    An explain query will have many different underlying types. Since Swift is a strongly typed language, a developer should specify the type expected to be decoded which will be different for mongoDB and PostgreSQL. One way around this is to use a type-erased wrapper such as the AnyCodable package.

    Declaration

    Swift

    func aggregateExplainPublisher<U: Decodable>(_ pipeline: [[String: Encodable]],
                                                 options: API.Options = []) -> Future<[U], ParseError>

    Parameters

    pipeline

    A pipeline of stages to process query.

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    A publisher that eventually produces a single value and then finishes or fails.

  • Executes a distinct query asynchronously and publishes unique values when complete.

    Requires

    .useMasterKey has to be available.

    Declaration

    Swift

    func distinctPublisher(_ key: String,
                           options: API.Options = []) -> Future<[ResultType], ParseError>

    Parameters

    key

    A field to find distinct values.

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    A publisher that eventually produces a single value and then finishes or fails.

  • Query plan information for executing a distinct query asynchronously and publishes unique values when complete.

    Requires

    .useMasterKey has to be available.

    Note

    An explain query will have many different underlying types. Since Swift is a strongly typed language, a developer should specify the type expected to be decoded which will be different for mongoDB and PostgreSQL. One way around this is to use a type-erased wrapper such as the AnyCodable package.

    Declaration

    Swift

    func distinctExplainPublisher<U: Decodable>(_ key: String,
                                                options: API.Options = []) -> Future<[U], ParseError>

    Parameters

    key

    A field to find distinct values.

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    A publisher that eventually produces a single value and then finishes or fails.

Queryable

  • Finds objects synchronously based on the constructed query and sets an error if there was one.

    Throws

    An error of type ParseError.

    Declaration

    Swift

    public func find(options: API.Options = []) throws -> [ResultType]

    Parameters

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    Returns an array of ParseObjects that were found.

  • Query plan information for finding objects synchronously based on the constructed query and sets an error if there was one.

    Note

    An explain query will have many different underlying types. Since Swift is a strongly typed language, a developer should specify the type expected to be decoded which will be different for mongoDB and PostgreSQL. One way around this is to use a type-erased wrapper such as the AnyCodable package.

    Throws

    An error of type ParseError.

    Declaration

    Swift

    public func findExplain<U>(options: API.Options = []) throws -> [U] where U : Decodable

    Parameters

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    Returns a response of Decodable type.

  • Finds objects asynchronously and calls the given block with the results.

    Declaration

    Swift

    public func find(options: API.Options = [],
                     callbackQueue: DispatchQueue = .main,
                     completion: @escaping (Result<[ResultType], ParseError>) -> Void)

    Parameters

    options

    A set of header options sent to the server. Defaults to an empty set.

    callbackQueue

    The queue to return to after completion. Default value of .main.

    completion

    The block to execute. It should have the following argument signature: (Result<[ResultType], ParseError>).

  • Query plan information for finding objects asynchronously and calls the given block with the results.

    Note

    An explain query will have many different underlying types. Since Swift is a strongly typed language, a developer should specify the type expected to be decoded which will be different for mongoDB and PostgreSQL. One way around this is to use a type-erased wrapper such as the AnyCodable package.

    Declaration

    Swift

    public func findExplain<U: Decodable>(options: API.Options = [],
                                          callbackQueue: DispatchQueue = .main,
                                          completion: @escaping (Result<[U], ParseError>) -> Void)

    Parameters

    options

    A set of header options sent to the server. Defaults to an empty set.

    callbackQueue

    The queue to return to after completion. Default value of .main.

    completion

    The block to execute. It should have the following argument signature: (Result<[Decodable], ParseError>).

  • Retrieves asynchronously a complete list of ParseObject‘s that satisfy this query.

    Declaration

    Swift

    public func findAll(batchLimit limit: Int? = nil,
                        options: API.Options = [],
                        callbackQueue: DispatchQueue = .main,
                        completion: @escaping (Result<[ResultType], ParseError>) -> Void)

    Parameters

    batchLimit

    The maximum number of objects to send in each batch. If the items to be batched. is greater than the batchLimit, the objects will be sent to the server in waves up to the batchLimit. Defaults to 50.

    options

    A set of header options sent to the server. Defaults to an empty set.

    callbackQueue

    The queue to return to after completion. Default value of .main.

    completion

    The block to execute. It should have the following argument signature: (Result<[Decodable], ParseError>).

    Warning

    The items are processed in an unspecified order. The query may not have any sort order, and may not use limit or skip.

  • Gets an object synchronously based on the constructed query and sets an error if any occurred.

    Warning

    This method mutates the query. It will reset the limit to 1.

    Throws

    An error of type ParseError.

    Declaration

    Swift

    public func first(options: API.Options = []) throws -> ResultType

    Parameters

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    Returns a ParseObject.

  • Query plan information for getting an object synchronously based on the constructed query and sets an error if any occurred.

    Warning

    This method mutates the query. It will reset the limit to 1.

    Note

    An explain query will have many different underlying types. Since Swift is a strongly typed language, a developer should specify the type expected to be decoded which will be different for mongoDB and PostgreSQL. One way around this is to use a type-erased wrapper such as the AnyCodable package.

    Throws

    An error of type ParseError.

    Declaration

    Swift

    public func firstExplain<U>(options: API.Options = []) throws -> U where U : Decodable

    Parameters

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    Returns a response of Decodable type.

  • Gets an object asynchronously and calls the given block with the result.

    Warning

    This method mutates the query. It will reset the limit to 1.

    Declaration

    Swift

    public func first(options: API.Options = [],
                      callbackQueue: DispatchQueue = .main,
                      completion: @escaping (Result<ResultType, ParseError>) -> Void)

    Parameters

    options

    A set of header options sent to the server. Defaults to an empty set.

    callbackQueue

    The queue to return to after completion. Default value of .main.

    completion

    The block to execute. It should have the following argument signature: (Result<ParseObject, ParseError>).

  • Query plan information for getting an object asynchronously and calls the given block with the result.

    Warning

    This method mutates the query. It will reset the limit to 1.

    Note

    An explain query will have many different underlying types. Since Swift is a strongly typed language, a developer should specify the type expected to be decoded which will be different for mongoDB and PostgreSQL. One way around this is to use a type-erased wrapper such as the AnyCodable package.

    Declaration

    Swift

    public func firstExplain<U: Decodable>(options: API.Options = [],
                                           callbackQueue: DispatchQueue = .main,
                                           completion: @escaping (Result<U, ParseError>) -> Void)

    Parameters

    options

    A set of header options sent to the server. Defaults to an empty set.

    callbackQueue

    The queue to return to after completion. Default value of .main.

    completion

    The block to execute. It should have the following argument signature: (Result<Decodable, ParseError>).

  • Counts objects synchronously based on the constructed query and sets an error if there was one.

    Throws

    An error of type ParseError.

    Declaration

    Swift

    public func count(options: API.Options = []) throws -> Int

    Parameters

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    Returns the number of ParseObjects that match the query, or -1 if there is an error.

  • Query plan information for counting objects synchronously based on the constructed query and sets an error if there was one.

    Note

    An explain query will have many different underlying types. Since Swift is a strongly typed language, a developer should specify the type expected to be decoded which will be different for mongoDB and PostgreSQL. One way around this is to use a type-erased wrapper such as the AnyCodable package.

    Throws

    An error of type ParseError.

    Declaration

    Swift

    public func countExplain<U>(options: API.Options = []) throws -> U where U : Decodable

    Parameters

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    Returns a response of Decodable type.

  • Counts objects asynchronously and calls the given block with the counts.

    Declaration

    Swift

    public func count(options: API.Options = [], callbackQueue: DispatchQueue = .main,
                      completion: @escaping (Result<Int, ParseError>) -> Void)

    Parameters

    options

    A set of header options sent to the server. Defaults to an empty set.

    callbackQueue

    The queue to return to after completion. Default value of .main.

    completion

    The block to execute. It should have the following argument signature: (Result<Int, ParseError>)

  • Query plan information for counting objects asynchronously and calls the given block with the counts.

    Note

    An explain query will have many different underlying types. Since Swift is a strongly typed language, a developer should specify the type expected to be decoded which will be different for mongoDB and PostgreSQL. One way around this is to use a type-erased wrapper such as the AnyCodable package.

    Declaration

    Swift

    public func countExplain<U: Decodable>(options: API.Options = [],
                                           callbackQueue: DispatchQueue = .main,
                                           completion: @escaping (Result<U, ParseError>) -> Void)

    Parameters

    options

    A set of header options sent to the server. Defaults to an empty set.

    callbackQueue

    The queue to return to after completion. Default value of .main.

    completion

    The block to execute. It should have the following argument signature: (Result<Decodable, ParseError>).

  • Executes an aggregate query synchronously and calls the given.

    Requires

    .useMasterKey has to be available.

    Throws

    An error of type ParseError.

    Warning

    This hasn’t been tested thoroughly.

    Declaration

    Swift

    public func aggregate(_ pipeline: [[String: Encodable]],
                          options: API.Options = []) throws -> [ResultType]

    Parameters

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    Returns the ParseObjects that match the query.

  • Executes an aggregate query asynchronously and calls the given.

    Requires

    .useMasterKey has to be available.

    Warning

    This hasn’t been tested thoroughly.

    Declaration

    Swift

    public func aggregate(_ pipeline: [[String: Encodable]],
                          options: API.Options = [],
                          callbackQueue: DispatchQueue = .main,
                          completion: @escaping (Result<[ResultType], ParseError>) -> Void)

    Parameters

    pipeline

    A pipeline of stages to process query.

    options

    A set of header options sent to the server. Defaults to an empty set.

    callbackQueue

    The queue to return to after completion. Default value of .main.

    completion

    The block to execute. It should have the following argument signature: (Result<[ParseObject], ParseError>).

  • Query plan information for executing an aggregate query synchronously and calls the given.

    Requires

    .useMasterKey has to be available.

    Note

    An explain query will have many different underlying types. Since Swift is a strongly typed language, a developer should specify the type expected to be decoded which will be different for mongoDB and PostgreSQL. One way around this is to use a type-erased wrapper such as the AnyCodable package.

    Throws

    An error of type ParseError.

    Warning

    This hasn’t been tested thoroughly.

    Declaration

    Swift

    public func aggregateExplain<U: Decodable>(_ pipeline: [[String: Encodable]],
                                               options: API.Options = []) throws -> [U]

    Parameters

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    Returns the ParseObjects that match the query.

  • Query plan information for executing an aggregate query asynchronously and calls the given.

    Requires

    .useMasterKey has to be available.

    Note

    An explain query will have many different underlying types. Since Swift is a strongly typed language, a developer should specify the type expected to be decoded which will be different for mongoDB and PostgreSQL. One way around this is to use a type-erased wrapper such as the AnyCodable package.

    Warning

    This hasn’t been tested thoroughly.

    Declaration

    Swift

    public func aggregateExplain<U: Decodable>(_ pipeline: [[String: Encodable]],
                                               options: API.Options = [],
                                               callbackQueue: DispatchQueue = .main,
                                               completion: @escaping (Result<[U], ParseError>) -> Void)

    Parameters

    pipeline

    A pipeline of stages to process query.

    options

    A set of header options sent to the server. Defaults to an empty set.

    callbackQueue

    The queue to return to after completion. Default value of .main.

    completion

    The block to execute. It should have the following argument signature: (Result<[ParseObject], ParseError>).

  • Executes an aggregate query synchronously and calls the given.

    Requires

    .useMasterKey has to be available.

    Throws

    An error of type ParseError.

    Warning

    This hasn’t been tested thoroughly.

    Declaration

    Swift

    public func distinct(_ key: String,
                         options: API.Options = []) throws -> [ResultType]

    Parameters

    key

    A field to find distinct values.

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    Returns the ParseObjects that match the query.

  • Executes a distinct query asynchronously and returns unique values.

    Requires

    .useMasterKey has to be available.

    Warning

    This hasn’t been tested thoroughly.

    Declaration

    Swift

    public func distinct(_ key: String,
                         options: API.Options = [],
                         callbackQueue: DispatchQueue = .main,
                         completion: @escaping (Result<[ResultType], ParseError>) -> Void)

    Parameters

    key

    A field to find distinct values.

    options

    A set of header options sent to the server. Defaults to an empty set.

    callbackQueue

    The queue to return to after completion. Default value of .main.

    completion

    The block to execute. It should have the following argument signature: (Result<[ParseObject], ParseError>).

  • Query plan information for executing an aggregate query synchronously and calls the given.

    Requires

    .useMasterKey has to be available.

    Note

    An explain query will have many different underlying types. Since Swift is a strongly typed language, a developer should specify the type expected to be decoded which will be different for mongoDB and PostgreSQL. One way around this is to use a type-erased wrapper such as the AnyCodable package.

    Throws

    An error of type ParseError.

    Warning

    This hasn’t been tested thoroughly.

    Declaration

    Swift

    public func distinctExplain<U: Decodable>(_ key: String,
                                              options: API.Options = []) throws -> [U]

    Parameters

    key

    A field to find distinct values.

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    Returns the ParseObjects that match the query.

  • Query plan information for executing a distinct query asynchronously and returns unique values.

    Requires

    .useMasterKey has to be available.

    Note

    An explain query will have many different underlying types. Since Swift is a strongly typed language, a developer should specify the type expected to be decoded which will be different for mongoDB and PostgreSQL. One way around this is to use a type-erased wrapper such as the AnyCodable package.

    Warning

    This hasn’t been tested thoroughly.

    Declaration

    Swift

    public func distinctExplain<U: Decodable>(_ key: String,
                                              options: API.Options = [],
                                              callbackQueue: DispatchQueue = .main,
                                              completion: @escaping (Result<[U], ParseError>) -> Void)

    Parameters

    key

    A field to find distinct values.

    options

    A set of header options sent to the server. Defaults to an empty set.

    callbackQueue

    The queue to return to after completion. Default value of .main.

    completion

    The block to execute. It should have the following argument signature: (Result<[Decodable], ParseError>).