2015-10-18 63 views
0

我在使用連接表的many-to-many關係的解析文檔中使用了相同的大小寫。 在我的情況下,我通過一個簡單的查詢獲取用戶列表,但我需要的是知道當前用戶是否在列表中跟隨用戶,這意味着我想將一個按鈕添加到允許當前用戶的用戶列表中根據他們的以下狀態關注或取消關注列表中的用戶。解析連接表關係

有沒有可能通過一個查詢獲得此信息?

回答

0

這會幫助你。見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) { 

    } 
});