我在和一个
afterFind
带有parse的cloud函数,只需执行一个额外的查询,并在响应中设置一个额外的对象。我希望在客户机中完全检索这个相同的对象,但它实际上是一个指针或其他东西,因为我需要调用
fetchIfNeeded
在访问它的数据之前。
Parse.Cloud.afterFind("PublicationImage", function(request, response) {
...
votesQuery.equalTo("author", user)
votesQuery.containedIn("target", publicationImagesIds);
votesQuery.find()
.then(function(votes) {
votes.forEach(function(vote) {
voteTarget = vote.get("target");
for (var i = 0; i < publicationImages.length; i++) {
if (publicationImages[i].id == voteTarget.id) {
publicationImages[i].set("userVote", vote); <-- Here I add an obj
}
}
});
response.success(publicationImages);
})
...
});