Skip to content

How to implement Parse query properly to get ordered data? #4707

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ashish-naik opened this issue Apr 9, 2018 · 1 comment
Closed

How to implement Parse query properly to get ordered data? #4707

ashish-naik opened this issue Apr 9, 2018 · 1 comment

Comments

@ashish-naik
Copy link

I have below code to build a query out of two queries.

Issue is result is not sorted by updatedAt.

What could be the issue?

let ownerQuery = PFQuery(className: "requests")
ownerQuery.whereKey("owner", equalTo: forUser)
ownerQuery.whereKey("stage", equalTo: "initiated")

let requestQuery = PFQuery(className: "requests")
requestQuery.whereKey("requested_by", equalTo: requestedBy)
requestQuery.whereKey("stage", equalTo: "accepted")

// fetch all request of current user as requestor or lender/seller
let query = PFQuery.orQuery(withSubqueries: [ownerQuery, requestQuery])

query.includeKey("requested_by")
query.includeKey("owner")
query.order(byDescending: "updatedAt")

Didn't get any answer in stack Overflow so posting here.

Thanks
Ashish

@flovilmart
Copy link
Contributor

Closing as he issue doesn’t matches the template. Please provide all the requested information, including logs, versions etc....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants