我必须从我的数据整理中获取检查点,这些检查点由objectId跟踪并匹配其中一个指针。我试过了。
var checkpoint = Parse.Object.extend("Checkpoint");
var q1 = new Parse.Query(checkpoint);
q1.equalTo("mission", {
__type: "Pointer",
className: "Mission",
objectId: mid
});
q1.equalTo("checkpointType", {
__type: "Pointer",
className: "CheckpointType",
objectId: "HJBdFD1p5f"
})
var q2 = new Parse.Query(checkpoint);
q2.equalTo("mission", {
__type: "Pointer",
className: "Mission",
objectId: mid
});
q2.equalTo("checkpointType", {
__type: "Pointer",
className: "CheckpointTYpe",
objectId: "m17T0wLzwl"
})
var q3 = new Parse.Query(checkpoint);
q3.equalTo("mission", {
__type: "Pointer",
className: "Mission",
objectId: mid
});
q3.equalTo("checkpointType", {
__type: "Pointer",
className: "CheckpointTYpe",
objectId: "mXPtoIRsI2"
})
var compquery = Parse.Query.or(q1,q2,q3);
return compquery.find({
success: function (results) {
console.log(results);
},
error: function (results, error) {
console.log(error);
}
});
}
我有这个代码,它返回一个空数组。有没有办法完成这项工作?
答案 0 :(得分:0)
此代码的问题是语法错误,
className: "CheckpointTYpe",
在所有查询中,应为CheckpointType
,但在我的代码中仅在第一次查询中
var q2 = new Parse.Query(checkpoint);
q2.equalTo("mission", {
__type: "Pointer",
className: "Mission",
objectId: mid
});
q2.equalTo("checkpointType", {
__type: "Pointer",
className: "CheckpointType",
objectId: "m17T0wLzwl"
})
var q3 = new Parse.Query(checkpoint);
q3.equalTo("mission", {
__type: "Pointer",
className: "Mission",
objectId: mid
});
q3.equalTo("checkpointType", {
__type: "Pointer",
className: "CheckpointType",
objectId: "mXPtoIRsI2"
})
var compquery = Parse.Query.or(q1,q2,q3);
return compquery.find({
success: function (results) {
console.log(results);
},
error: function (results, error) {
console.log(error);
}
});
}