Javascript 未成功编辑分析对象
我正在编写一个函数,用于查询与相应用户关联的matchCenterItem对象的解析,然后编辑该对象的某些属性。进行查询时,响应结果以以下形式返回:Javascript 未成功编辑分析对象,javascript,parse-platform,Javascript,Parse Platform,我正在编写一个函数,用于查询与相应用户关联的matchCenterItem对象的解析,然后编辑该对象的某些属性。进行查询时,响应结果以以下形式返回: <matchCenterItem: 0x7f84e2c1a4b0, objectId: Je1VxP7dPw, localId: (null)> { categoryId = 9355; itemCondition = Used; itemLocation = US; maxPrice = 350;
<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";
}
将代码更改为此,现在可以使用:
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({
success: 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!');
},
error: function() {
response.error('MatchCenterItem NAAAAT 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({
success: 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!');
},
error: function() {
response.error('MatchCenterItem NAAAAT successfully edited!');
}
});
});