我已经创建了一个称为用户的解析表中的表,并有一个关系字段的朋友指向同一个表user.Now我已经取得骨干收集的用户和我得到一个单一的用户。我怎样才能得到包含到字段朋友对象的列表?我已经通过get方法骨干尝试过,但它返回一个像这样的对象:Object {__type:“Relation”,className:“_User”}。在parse.com关系领域的Retriew对象
var cur_user = Parse.User.current().id;
var self = this;
Models.utenti = new Usercollection();
Models.utenti.fetch({
success: function (object) {
var cur_user = Parse.User.current().id;
// So this gives u a user Model
var user = Models.utenti.get(cur_user);
// Lets say the friends list is not a Collection yet
// Assuming it's just an object
var friends = user.get("friends"));
// Create a Friends Collection
var Collections.friends = New FriendCollection(friends);
var view = new FriendsView({
collection: Collections.friends
});
self.changePage(view);
},
error: function (amici, error) {
console.log("don t work");
}
你到底是在响应返回什么时候收集获取..我希望它是'Models.utenti'权利的更新列表? –
是的,它返回更新的集合 –
那么你为什么要在这里使用'对象',你可以直接访问集合..而恶魔列表是一个收集权..为什么你想要通过作为模型..将它作为集合传递 –