Reputation: 35
Im currenlty trying out parse.com to use it as a repository for sensor messages. I do some data science with those messages using python but when trying to GET the class where I have the entries I can only GET a maximum of 1000. I though a possibility would be to run a job that export all the entries to a csv or json, can that be done on the cloud code platform?
Upvotes: 0
Views: 50
Reputation: 81
You can simply use query.skip(10000) code to get more but skip cannot be larger than 10000.
Or you can use this simple code to export entire class
https://github.com/mkim871/parse-node-backup
Upvotes: 0
Reputation: 62676
Queries provide skip
, so the nice way to do this in cloud/JS is to chain promises recursively, skipping the count of objects already retrieved:
function unboundedQuery(query, array) {
array = array || [];
query.limit(1000);
query.skip(array.length);
return query.find().then(function(results) {
array.push(results);
return (results.length == 1000)? runQuery(query, array) : array;
});
}
Call it like this:
var query = new Parse.query("Class");
// qualify, sort, etc, but no need to set limit or skip
unboundedQuery(query).then(function(results) {
// results will contain all objects in "Class", unless it timed out
});
Upvotes: 1