0
votes

I have the same case that is used in the Parse documentation for many-to-many relations using a join table. In my case I am fetching a list of users by a simple query, but what I need is to know if current user following the user in the list, meaning I want to add a button to the list of users that allows the current user to follow or unfollow users in the list based on their following status.

Is there any chance that I can get this info with one query?

1

1 Answers

0
votes

this will help you. see Relational Queries

var following = Parse.Object.extend("Following"); //Following (ParseObject)
var currentUser = Parse.User.current();
var innerQuery = new Parse.Query(following);
innerQuery.exists("status");
var query = new Parse.Query(currentUser);
query.matchesQuery("follow", innerQuery); //follow is pointer type  
query.find({
  success: function(comments) {

  }
});