0
votes

I have a question about subtracting certain data and retrieving only one column. I have two class. "Flag" and "Post". When user flags the post, new data is being made in "Flag" class. "Flag" class has 3 columns: fromUser(pointer), toUser(pointer), postID(objectID of a post).

My app basically plays media and I want to take out flagged contents. Let's say there are 5 media to be shown and 2 of them are flagged. Then, I just want to show rest of them, 3.

Below are my codes:

var queryForPost = PFQuery(className: "Post")
var queryForFlaggedPost = PFQuery(className: "Flag")
    queryForPost.whereKey("forEvent", equalTo: self.event!)

    queryForFlaggedPost.whereKey("fromUser", equalTo: PFUser.currentUser()!)

    queryForPost.whereKey("objectID", doesNotMatchQuery: queryForFlaggedPost)

    queryForPost.findObjectsInBackground()

After running this code, the console result I get is
2015-09-16 19:56:28.654 *[59699:4007580] [Error]: bad type for $notInQuery (Code: 102, Version: 1.7.5) we just fetched nil videos Optional(Error Domain=Parse Code=102 "bad type for $notInQuery" UserInfo=0x7ffb5509bb10 {code=102, originalError=Error Domain=NSURLErrorDomain Code=-1011 "The operation couldn’t be completed. (NSURLErrorDomain error -1011.)", temporary=0, error=bad type for $notInQuery, NSLocalizedDescription=bad type for $notInQuery}) 2015-09-16 19:56:28.708 *[59699:4007695] [Error]: object not found for update (Code: 101, Version: 1.7.5)

Can you guys tell me what I am doing wrong?

1

1 Answers

0
votes

Discussion Warning: This only works where the key’s values are PFObjects or arrays of PFObjects.` from Reference

That's probably the "bad type". However, there are another method called whereKey:doesNotMatchKey:inQuery. You might want to take a look at that, check reference above. Good luck!