gpt4 book ai didi

javascript - 查找具有字段值的对象(这是一个指针)

转载 作者:行者123 更新时间:2023-11-29 21:52:13 25 4
gpt4 key购买 nike

我在类里面说“检查”,并且有一个字段名称属性(这是一个指针)。我正在尝试按字段值检索记录,但没有得到任何结果。我正在使用以下代码

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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com