Javascript 또는 Cloud Code에 익숙하지 않고 어제 CC를 사용하기 시작했습니다. 이것은 매우 간단한 작업처럼 보이지만, 나는 이것을 알아 내려고 머리를 세게 치고 있습니다. 는 '채팅'객체가 구문 분석을 저장하면Parse Cloud 코드 증가 문제
, 나는 '대화방'객체, ChatRooms.objectId = Chat.RoomId
쉬운의 (형식 번호) 필드를 'numberOfMessages'을 증가하고 싶다. 나는 많은 것들을 시도해 왔으며, 여기 Parse Docs에서 곧바로 최신 버전이있다. 이 예에서
Parse.Cloud.beforeSave("Chat", function(request, response) {
query = new Parse.Query("ChatRooms");
query.get(request.object.get("roomId"), {
success: function(post) {
post.increment("numberOfMessages", 1);
post.save();
response.success();
},
error: function(error) {
console.error("Got an error " + error.code + " : " + error.message);
response.error();
}
});
});
는 오류가 :
ReferenceError: response is not defined
at query.get.success (main.js:7:33)
at Parse.js:2:7706
at e (Parse.js:2:6486)
at Parse.js:2:5935
at Array.forEach (native)
at Object.x.each.x.forEach [as _arrayEach] (Parse.js:1:664)
at c.extend.resolve (Parse.js:2:5886)
at e (Parse.js:2:6621)
at Parse.js:2:5935
at Array.forEach (native) (Code: 141, Version: 1.5.0)
모든 포인터가 평가된다.
마침내 .. 파스 클라우드 코드와 관련하여 Javascript를 배우기위한 훌륭한 자료가 있습니까? 내 검색이 유용하지 않습니다. 감사!
열 ChatRooms.roomId가 포인터 또는 문자열입니까? – Seth
Chat.roomId는 주어진 ChatRooms.objectId가 포함 된 문자열입니다. –