Search code examples
javascriptparse-platformionic2parse-server

parse server include pointer in relation query javascript sdk


Hello i am using a parse server as a backend for my ionic 2 app

now i have a table of users containing a freinds column with object ids from the same class and this cloumn type is a relation

i managed to get the user friends through the following code

var currentUser = Parse.User.current();
if (currentUser) {
  var friendRelation = currentUser.relation('friends');             
  friendRelation.query().find({
    success: function(friends) {
       for (var i = 0; i< friends.length; i++) {
       var object = friends[i];
       this.friendsglobalvariable.push(object)

        } 

      } 
    }); 

my problem is that each friend of these has a column of type pointer which points to photos class containg a profile picture

when i try to read this pointer it only gives me the object id of the photo

how i can get all the photo details from pointer included relation query


Solution

  • I managed to solve it my self

    it already gives all the pointer details with the relation but the problem was that profile photo field for some friends was null

    so i add some checks in the template and it works now