How to get all datas of an class in Parse with Cloud Coding?

444 views Asked by At

I have a sample GameScore class in Parse and i want to get all datas from this class with cloud coding. I suppose i missed something. My code is below.

var GameScore = Parse.Object.extend("GameScore");
    var query = new Parse.Query(GameScore);

    query.find({
      success: function(results) {
        // results is an array of Parse.Object.
        alert("Successfully retrieved " + results.length + " user.");
        for(var i = 0 ; i < results.length;i++)
        {

            var object = results[i];
            alert(object.id + ' - ' + results[i].get("objectId"));
        }
      },

      error: function(error) {
        // error is an instance of Parse.Error.
        status.error("Error:" + error.code + "  Message" + error.message);
      }
    });

How can get all datas?

1

There are 1 answers

0
Technoid On

GameScore in 2nd line must be in quotes. And this code returns only 100 results.Since parse default query limits to 100. Set query.limit(1000) to get 1000 results.

And if you have more than 1000 results,you need to do something extra. Check this link.I answered there: How to get more than 1000 results Parse