Closed
Description
http://stackoverflow.com/questions/39955488/parse-relation-fetching-related-object-data
I have a Class called commonWall and it is related to User class.
I have a column of type 'relation' to User in class commonWall named clubbedUsers.
I want to get the list of related users. What would be the appropriated code for that?
Below is my code.. but it is not working... it returns
{"_type":"Relation","className":"User"}
no object id for the relationship is returned..
var CommonWall = Parse.Object.extend("CommonWall");
var q = new Parse.Query("CommonWall");
q.include("clubbedUsers");
q.limit(10);
q.equalTo("heading","- 30%");
q.find()
.then((responseData) => {
let listviewDataArray = JSON.parse(JSON.stringify(responseData));
// console.warn(JSON.stringify(responseData));
// console.warn(JSON.stringify(Parse.User.current().id));
for (var i = listviewDataArray.length - 1; i >= 0; i--) {
console.warn(JSON.stringify(responseData[i].relation("clubbedUsers")));
responseData[i].relation("clubbedUsers").query().each()
//if(userRelation !== "undefined")
// userRelation.find()
.then((responseData1) => {
console.warn(JSON.stringify(responseData1));
});
}
resolve(listviewDataArray);
})
.catch(function(error) {
console.warn(error)
reject({status: 'could not refresh wall!'});
});
Metadata
Metadata
Assignees
Labels
No labels