I am storing an array of Javascript objects in Parse under the name 'AcceptedInvitees'. The objects each have two values; an example entry is:
[{"id":"QpAETvSYaB","type":"Requested"},{"id":"Ojjp3TdmTM","type":"unknown"},{"id":"STAUUgVxJp","type":"unknown"},{"id":"AXBC5iZvKQ","type":"unknown"},{"id":"YixKjqrjTM","type":"unknown"},{"id":"b2YwmMcO6n","type":"unknown"},{"id":"DjZePR0Wif","type":"unknown"},{"id":"94Harl1hxm","type":"unknown"},{"id":"1bOE07B0C8","type":"unknown"}]
I am trying to retrieve this value using .get("AcceptedInvitees"), but I am being returned an array of empty objects. For example, retrieving the above entry gives me
[{},{},{},{},{},{},{},{},{}]
This is the specific code I am using to query the data. All the other fields are being retrieved without a problem, but printing node.children gives me the above.
var query = new Parse.Query("UserInvite");
query.include("AcceptedInvitees");
query.get(id, {
success: function (user) {
node.name = user.get("name");
node.TotalInvitees = user.get("TotalInvitees");
node.type = type;
node.children = user.get("AcceptedInvitees");
}
Any help with this would be greatly appreciated!
答案 0 :(得分:0)
Parse.Query
expects Parse.Object
. Therefore, do as following:
var UserInvite = Parse.Object.extend("UserInvite");
var id = 'someUserInviteId';
var query = new Parse.Query(UserInvite);
query.include("AcceptedInvitees");
query.get(id, {
success: function(obj) {
console.log(obj.toJSON());
},
error: function(err) {
console.log(err);
}
});