【问题标题】:How to use a Relation column in Parse.com for Android如何在 Parse.com for Android 中使用关系列
【发布时间】:2015-03-01 12:30:47
【问题描述】:

我想知道如何在 Parse 中使用 Relation 列,我一直在寻找这个,但我没有找到太多关于这个的信息,我找到了下面的链接:Parse Relations Developer Guide

但是我没有找到有用的信息,反正我有一个 Publications 类和一个 Comments 类,每个出版物都有不同的 cmets,

那么我将如何使用它,例如获得一份出版物的所有 cmets。

那会很有帮助。

【问题讨论】:

    标签: android parse-platform relation


    【解决方案1】:

    我已经找到了如何做到这一点,查看 Parse 开发人员指南:

    例如,如何在出版物中插入评论:

     commentaire = new ParseObject("Commentaires"); 
        commentaire.put("commentaire", "test1");
        commentaire.saveInBackground(new SaveCallback() {
           public void done(ParseException e) {
              message.getRelation("commentaires").add(commentaire);
          message.saveInBackground();
    

    检索更简单:

    ParseUser user = ParseUser.getCurrentUser();
    ParseRelation<ParseObject> relation = user.getRelation("commentaires");
    

    我希望这会对某人有所帮助

    更多信息请查看:Parse Developer Guide

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-12-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多