Amazon web services 解析服务器云代码查询不';t返回所有列

Amazon web services 解析服务器云代码查询不';t返回所有列,amazon-web-services,parse-platform,amazon-elastic-beanstalk,parse-server,Amazon Web Services,Parse Platform,Amazon Elastic Beanstalk,Parse Server,我已经按照以下指南在AWS弹性Beanstalk上安装了解析服务器。然后,我编写了一个云代码函数,它从特定的类/集合中获取一条记录。该集合包含大约20列。但是,作为查询结果获取的对象只包含大约8列。我已经确保记录的列中确实有查询遗漏的数据。我是在这里遗漏了什么,还是在解析中有一些限制?有没有办法强制Parse获取这些列 Parse.Cloud.define('confirmAppointment', function(request, response) { var staffId =

我已经按照以下指南在AWS弹性Beanstalk上安装了解析服务器。然后,我编写了一个云代码函数,它从特定的类/集合中获取一条记录。该集合包含大约20列。但是,作为查询结果获取的对象只包含大约8列。我已经确保记录的列中确实有查询遗漏的数据。我是在这里遗漏了什么,还是在解析中有一些限制?有没有办法强制Parse获取这些列

Parse.Cloud.define('confirmAppointment', function(request, response) {
    var staffId = request.params.staffId;
    var appointmentId = request.params.appointmentId;

    var appointmentRequest = Parse.Object.extend("AppointmentRequest");
    appointmentRequest.id = appointmentId;
    appointmentRequest.staffId = staffId;

    var query = new Parse.Query(appointmentRequest);

    query.first({
        useMasterKey: true,
        success: function(appointment) {
            if (appointment) {

                // these fields are not found in the fetched appointment object
                // they do exist however in mongodb
                var requesterUserId = appointment.get("requesterUserId");
                var staffUserId = appointment.get("staffUserId");
                var staffName = appointment.get("staffNameEn");
                ...
            }
        }
        ...
    });
});

您的代码中可能有一些输入错误(查询部分的构造)。请尝试以下方法:

Parse.Cloud.define('confirmAppointment', function(req, res) {
  var staffId = req.params.staffId;
  var appointmentId = req.params.appointmentId;

  var query = new Parse.Query("AppointmentRequest");
  query.equalTo('objectId', appointmentId);
  query.equalTo('staffId', staffId);

  query.first({
    useMasterKey: true,
    success: function(appointment) {
      res.success(appointment.get("requesterUserId"));
    },
    error: function(err) {
      res.error(err);
    }
  });
});

问题是,当我将数据从Parse迁移到MongoDB托管的MongoDB实例时,我没有在Parse迁移向导中单击“Finalize”按钮。这是故意的,因为Parse警告我,单击Finalize将使迁移永久化,我将无法再返回到Parse管理的数据库。另一方面,我可以看到所有的数据都成功地迁移到了mongolab,从技术上讲,它应该足以让我的AWS托管解析服务器在这个新数据库上工作,而不会出现任何问题。但不知何故,在Parse中单击“Finalize”按钮产生了一些魔力(我仍然不明白它可能是什么),我的查询开始返回预期的结果

在迁移到Heroku时,我也能够重现同样的问题,因此我确信这与AWS无关


希望这能对其他人有所帮助。

缺少的列是指向其他对象的指针类型吗?不是。其中有些是字符串类型,有些是数字类型。谢谢Simon,查询确实有一些输入错误,我后来修复了这些错误。但真正的问题是,我没有在解析数据库迁移向导中单击Finalize按钮。