Parse.com JS - 使用Pointer-column更新行

时间:2014-07-12 16:19:34

标签: javascript parse-platform

我正在使用Parse和JavaScript。

我知道 Status_id -class中的ObjectId但是无法更新 Question_status -class中的列,因为它是指针类型

如何使用JavaScript更新指针列。

var Answer = Parse.Object.extend("Question_status");
    var answer = new Answer();
    answer.id = question_status_id;
    answer.set("answer", selectedAnswer);
    answer.set("status_id", "duMW5p8Dh3");

    answer.save(null, {
      success: function(answer) {
        //console.log('New object created with objectId: ' + answer.id);
        $.mobile.changePage( "#finish", { transition: "slideup", changeHash: false });
      },
      error: function(answer, error) {
        console.log('Failed to create new object, with error code: ' + error.description);
      }
    });

1 个答案:

答案 0 :(得分:1)

你基本上可以创建一个指针,就像你使用question_status一样:

var answer = new Parse.Object("Question_status");
answer.id = question_status_id;
answer.set("answer", selectedAnswer);

var status = new Parse.Object("Status_id");
status.id = "duMW5p8Dh3";
answer.set("status_id", status);

answer.save(...