0
votes

I am running a PFQuery on the main _User table (ACL is read-only if the user isn't the PFUser.currentUser).

I am logging a count for profile views.

Since the PFUSer table cannot be incremented by anyone other than the currentUser, I have to store the count in a separate table. Call this table "ViewCount," with pointer column "userId" that points back to the PFUser table.

How can I filter a query on the main PFUser table for users with a given count from the ViewCount table?????

 let query = PFUser.query()!

 //perform filters here

 query.findObjectsInBackgroundWithBlock({
1

1 Answers

0
votes

You can do this with a subquery.

let query = PFUser.query()!

let subQuery = PFQuery(className: "viewCount")
subQuery.whereKey("count", greaterThan: yourCount)
query.whereKey("userCount", matchesQUery: subQuery)

...
//rest of query info