我有一个类说“检查”,并且有一个字段名称属性(这是一个指针)。我试图按字段值检索记录,但没有得到任何结果。我正在使用以下代码
getInspectionByProperty = function(req) {
console.log(req.body.propertyId)
var query = new Parse.Query("Inspection");
query.include('property');
query.equalTo('property', req.body.propertyId);
query.find({
success: function(data) {
console.log('in success');
console.log(data);
// Successfully retrieved the object.
},
error: function(error) {
console.log('in error')
console.log("Error: " + error.code + " " + error.message);
}
});
};
我在解析日志中收到此错误
Error: 102 pointer field property needs a pointer value
我怎样才能获得记录。提前致谢
最佳答案
这是我尝试的,这对我有用。
getInspectionByProperty = function(req) {
console.log(req.body.propertyId)
var query = new Parse.Query("Inspection");
query.include('property');
query.equalTo("property", {
"__type": "Pointer",
"className": "Property",
"objectId": propertyId
});
query.find({
success: function(data) {
console.log('in success');
console.log(data);
// Successfully retrieved the object.
},
error: function(error) {
console.log('in error')
console.log("Error: " + error.code + " " + error.message);
}
});
};
关于javascript - 查找具有字段值的对象(这是一个指针),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28560803/