0
我正在写一个函数,查询与各个用户关联的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";
}
然后我想更新发送与PARAMS领域。当功能运行时,它打印出'MatchCenterItem successfully edited!'
,但当我检查仪表板时,该项目根本没有更新。我错过了什么吗?完整的代码如下。
Parse.Cloud.define("editMatchCenter", function(request, response) {
var matchCenterItem = Parse.Object.extend("matchCenterItem");
var query = new Parse.Query(matchCenterItem);
query.contains('searchTerm', request.params.searchTerm);
query.equalTo('parent', Parse.User.current())
query.first().then(function(results) {
results.set('minPrice', request.params.minPrice);
results.set('maxPrice', request.params.maxPrice);
results.set('itemCondition', request.params.itemCondition);
results.set('itemLocation', request.params.itemLocation);
results.save();
});
response.success('MatchCenterItem successfully edited!');
});