How to retrieve more than 1000 rows from Parse.com?
I have figured out how to achieve my goal:
Declare Global Variable
private static List<ParseObject>allObjects = new ArrayList<ParseObject>();
Create Query
final ParseQuery parseQuery = new ParseQuery("Objects");
parseQuery.setLimit(1000);
parseQuery.findInBackground(getAllObjects());
Callback for Query
int skip=0;
FindCallback getAllObjects(){
return new FindCallback(){
public void done(List<ParseObject> objects, ParseException e) {
if (e == null) {
allObjects.addAll(objects);
int limit =1000;
if (objects.size() == limit){
skip = skip + limit;
ParseQuery query = new ParseQuery("Objects");
query.setSkip(skip);
query.setLimit(limit);
query.findInBackground(getAllObjects());
}
//We have a full PokeDex
else {
//USE FULL DATA AS INTENDED
}
}
};
}
How to get more than 1000 results Parse
I am using this code presently. This can fetch more than 1000 results.
The values are sorted according to "objectId". You can sort according to "createdAt" by changing accordingly.
Final results are stored in result array
var result = [];
var processCallback = function(res) {
result = result.concat(res);
if (res.length == 1000) {
process(res[res.length-1].id);
return;
}
//To print all the ids
for(var i=0;i<result.length;i++){
console.log(result[i].id);
}
}
var process = function(skip) {
var query = new Parse.Query("ObjectName");
if (skip) {
query.greaterThan("objectId", skip);
}
query.limit(1000);
query.ascending("objectId");
query.find().then(function querySuccess(res) {
processCallback(res);
}, function queryFailed(error) {
});
}
process(false);
Parse.com request per second limit?
Any request to the parse server is counted and his limitation is described on the website ( with new pricing, default req/s = 30 , so 1800 requests per minute).
Basically you have to retrieve as many elements as possible/needed with less number of request to parse ( balanced with the necessity and performance of course ), up to the limit of 1000 rows for query.
Anyway imagine you already have the list of photo objects ( let's say ,a list of Photo as Parse object ) and each one keep the image file field, any call to the direct image url is not counted for the burst limit
Hope it helps
Parse.com Query only returning first 100
From the Parse Docs:
You can limit the number of results by calling Limit. By default,
results are limited to 100, but anything from 1 to 1000 is a valid
limit:
Related Topics
Recycle-View Inflating Different Row :- Getting Exception While Binding the Data
How to Display Map (Google) on a Phonegap Android Application
Error Building Player: Commandinvokationfailure: Unable to Convert Classes into Dex Format
How to Solve Nullpointerexception Error in Android
How to Handle One-Shot Operations in Jetpack Compose
Adb Cannot Start Daemon, Createprocess Failure, Error 2
Android - Firebase Quickstart Email/Password Auth Demo Doesn't Work
"No Enclosing Instance of Type" Error While Calling Method from Another Class in Android
Masked Input Using Edittext Widget in Android
Volley Not Calling Getparams() for Standard Post Request
Using Onclick Attribute in Layout Xml Causes a Nosuchmethodexception in Android Dialogs
How to Add "Android Design Support Library" to Eclipse with Adt-Plugin
Android Support Multidex Library Implementation
Is Deprecated Word the Only Difference Between Fill_Parent and Match_Parent