在Parse中检索objectId

时间:2015-03-03 16:53:09

标签: javascript jquery html html5 parse-platform

简单来说,我试图在解析中为特定用户检索objectId(使用Javascript)。我可以检索数据库中的任何其他查询,例如用户名,电话,邮件地址,但不是objectId,这里是我如何检索查询的其余部分:

     var objectId = userInfo.get("objectId");

非常感谢任何协助。

下面是代码的更多行(在objectId旁边检索所有内容)

query.find({ success: function(array) {

           // this means the query was a success, but we're not yet certain that we found anything
           // the param to find's success is an array of PFObjects, possibly empty

           if (array.length > 0) {
               var userInfo = array[0];
               var address = userInfo.get("address");
               $scope.address = address;

               var email = userInfo.get("username");
               $scope.email = email;


          var fullName = userInfo.get("fullName");
               $scope.fullName=  fullName;

             var number = userInfo.get("phoneNumber");
               $scope.number=  number;


             var objectId = userInfo.get("objectId");
               $scope.objectId=  objectId;

          var mailingAddress = userInfo.get("mailingAddress");
               $scope.mailingAddress =  mailingAddress;

             var plan = userInfo.get("plan");
               $scope.plan =  plan;

提前致谢

1 个答案:

答案 0 :(得分:1)

js sdk提供id成员,所以......

$scope.objectId = userInfo.id;

另外,check out the JS guide在他们的网站上。这是一篇写得很好的文档。请特别注意对象和查询部分中的代码片段。