Reputation: 1783
My class Posts has a column that is a pointer to another class called Styles. Each post must be associated to a Style object as a rule of thumb.
My problem: I can't get only the posts that are associated to one or more styles.
My object selectedStyles
, that is an array of PFObjects that already contains the style objects I would like to use to match the query. So populating the selectedStyles
is not an issue, but how to use it to produce my query is.
What I am doing at the moment is:
override func queryForTable() -> PFQuery {
var query = PFQuery(className: "Posts")
query.whereKey("bellongsToStyle", containsAllObjectsInArray: [selectedStyles])
query.orderByDescending("createdAt")
return query
If I could translate the whereKey method in plain english I would say:
...contains - ANY OF THE - PFObjectsInArray [selectedStyles]
I am not so sure if that is possible... any ideas?!
Upvotes: 0
Views: 102
Reputation: 160
I think I am too late for this but you can just add
[IncludeKey:"bellongsToStyle"]
when you are querying in your 'Posts' class don't need to run any extra query for that
here's a small reference
http://blog.parse.com/announcements/queries-for-relational-data/
Upvotes: 2