无约束Parse查询返回空白对象

时间:2015-03-04 05:09:07

标签: javascript parse-platform

我通常使用objectId对一个类的定向对象进行查询,并且它一直在顺利进行。但是我现在正试图在给定的类中获取所有对象。

        var values;
        var Class = Parse.Object.extend(className);
        var query = new Parse.Query(Class);
        console.log(objectID);
        if (typeof objectID !== "undefined") { //if the user specified objectID
          query.get(objectID, {
            success: function(retrieveObject) {
              for (var i = 0; i < keys.length; i++) {
                values[i] = query.get(keys[i]);
              }
            },
            error: function(error) {
              console.log("Failed to retrieve " + className + ': ' + error.message);
            }
          });
        } else { //if not return all
          query.limit(1000);
          query.exists("objectId");
          query.find({
            success: function(results) {
              console.log("the results are " + results);
              for (var i = 0; i < results.length; i++) {
                for (var j = 0; j < keys.length;j ++)
                console.log("key " + j + " is " + keys[j]);
                console.log("the result for " + j + " is " + results[i]);
                var object = results[i];
                values[i][j] = object.get(keys[j]);
                console.log("the value for the key in result is " + values[i][j]);
              }
            },
            error: function(error) {
              console.log("Failed to retrieve " + className + ': ' + error.message);
            }
          });
        }

对于我的生活,我无法弄清楚为什么这不起作用。 &#34;结果&#34;作为正确数量的值的数组出现,但每个都是&#34; [对象对象]&#34;

有什么想法吗?

0 个答案:

没有答案