Parse Cloud Code New SDK Include Subclass Not Working
I was using an old parse SDK version 1.5.0 and my function was returning with all the includes. Now I tried to use the latest SDK and the function is returning the main object only
Solution 1:
I started working with Parse recently so I'm not very familiar with the behavioiur of old SDK versions.
Since you're in Cloud Code, however, .include()
doesn't warrant a significant performance gain over .fetch()
, since the code runs on their infrastructure (it's the documented way of accessing related Parse.Object
s, so they should be optimizing for that anyway), so the following should work:
var _ = require('underscore');
var results;
gateToUserQuery.find().then(function (joins) {
// add results to bigger-scoped variable
// for access in the other function
results = joins;
// Promises are beautiful
var fetchPromises = _.map(results, function (join) {
return Parse.Promise.when([
join.get('gate').fetch(),
join.get('location').fetch()
]));
});
return Parse.Promise.when(fetchPromises);
}).then(function () {
// related Pointers should be filled with data
response.success(results);
});
I think at least in the current iteration of the SDK, include
only works with Arrays instead of Pointers.
Post a Comment for "Parse Cloud Code New SDK Include Subclass Not Working"