1
클라우드 코드 쿼리 응답이 null 또는 비어 있는지 확인하고 싶습니다. 쿼리가 무언가를 찾으면 코드가 작동합니다. 쿼리와 일치하는 개체가 없으면 처리 할 수 없습니다. 어떻게해야합니까? 쿼리 응답이 비어있는 방법 구문 분석 서버?
Parse.Cloud.define("testing", function(request, response) {
var queryCheckRepeatedPost = new Parse.Query("Update");
queryCheckRepeatedPost.equalTo("updateValid", true);
queryCheckRepeatedPost.first({
useMasterKey: true,
success: function(repeatedPost) {
//Sometimes query return an object
//Sometimes there are no objects to return
},
error: function() {
response.error("Error 01");
}
});
});
나는 시도했다 : 그들 중
Object.keys(repeatedPost).length === 0
var value = results[0].get("objectId");
if (value == null){
}
그러나 어느 것도 작동하지 않습니다.
if (repeteadPost) {// then not null}? –
작동하지 않습니다. Parse 쿼리는 쿼리와 일치하는 개체가 없더라도 성공을 반환합니다. 이 응답에 개체가 있는지 확인해야합니다. –