I have a Cloud Code function that queries some data and returns it separated into groups. For each record on these groups, I need to also get information of a column which is a pointer. My cloud code is:
var queryAuctionParticipant = new Parse.Query('AuctionParticipant');
queryAuctionParticipant.equalTo('userId', request.user);
queryAuctionParticipant.include('auctionId');
queryAuctionParticipant.include('auctionId.creatorId');
queryAuctionParticipant.findAll({
success: function(resultAuctionParticipant) {
var grouped = {
upcoming : [],
previous : [],
running : [],
};
for (var i=0; i<resultAuctionParticipant.length; i++) {
var obj = resultAuctionParticipant[i];
var auctionId = obj.get('auctionId');
if (obj.get('auctionId').get('startsAt') > now) {
grouped.upcoming.push(auctionId);
}
else if (obj.get('auctionId').get('endsAt') < now) {
grouped.previous.push(auctionId);
}
else {
grouped.running.push(auctionId);
}
}
response.success(grouped);
},
error: function(error) {
response.error(error, error.code);
}
});
Everything fine until here. If I try to console.log
the .get('auctionId').get('creatorId')
of any of the records in the Cloud Code function, all the data is logged perfectly, no problem.
However, on the result of my callFunctionInBackground
, the creatorId
column is converted to a PFUser
instance (correct) but the instance is empty, none of the columns are present.
It seems that Parse's SDK isn't parsing the result from JSON to PFObject/PFUser in a very deep level. It means if I have many pointers inside pointers, it won't retrieve the data, even using Parse's mechanism for including keys and/or pointers.
Any thoughts?
Thanks!