我在解析中有元素数组。每个对象有 2 个成员。 日期和指向用户的指针。 我查询以数组为字段的对象。我怎样才能包含这个数组,我也会收到用户而不是指针?
数组:
[{date:dateObject,user:pointer},....]
我知道
query.include(' ')
但是我如何将它制作成数组呢?
谢谢
最佳答案
您必须手动获取它们,include 在这里不起作用。
尝试这样的事情:
query.find().then(function(results) {
// get array of pointers to users
var arrayOfPointers = [];
for (var i=0; i<results.length; i++) {
// we need the second element of each object
arrayOfPointers.push(results[i][1]);
}
// now fetch all the users
Parse.Object.fetchAll(arrayOfPointers).then(function(list) {
// do something with list of fetched users
});
});
关于parse-platform - 解析包含指针数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33117448/