我在Parse后台工作中运行以下内容:
var pushIncrement = Parse.Object.extend("pushIncrement");
var pushIncrementQuery = new Parse.Query(pushIncrement);
pushIncrementQuery.equalTo('objectId', 'hKj2Eazz6h');
pushIncrementQuery.find({
success: function(results) {
console.log('Here are the results:' + results);
status.success("Completed successfully.");
},
error: function(error) {
console.log('shit');
status.error('shitty shit');
}
});
results
是一个Parse对象。例如,如果我正在查询所有matchCenterItem
个对象,则会返回results
,格式如下:
<matchCenterItem: 0x7f84e2c1a4b0, objectId: Je1VxP7dPw, localId: (null)> {
categoryId = 9355;
itemCondition = Used;
itemLocation = US;
maxPrice = 350;
minPrice = 250;
parent = "<PFUser: 0x7f84e2c20c10, objectId: kfEHfG4FUD>";
searchTerm = "iphone 5 unlocked";
}
现在,如果我想访问categoryId
的{{1}}属性并且控制台记录它,我该怎么做?我在成功函数中尝试了类似下面的内容,但它没有像我预期的那样工作:
results
答案 0 :(得分:0)
想出来,可以这样做:
var pushIncrement = Parse.Object.extend("pushIncrement");
var pushIncrementQuery = new Parse.Query(pushIncrement);
pushIncrementQuery.equalTo('objectId', 'hKj2Eazz6h');
pushIncrementQuery.find({
success: function(results) {
for (var i = 0; i < results.length; ++i) {
var dayNumber = results[i].get("Number");
}
console.log('dem results be:' + dayNumber);
status.success("Push Notifications completed successfully.");
},
error: function(error) {
console.log('shit');
status.error('shitty shit');
}
});