kevinohara80 / nforce

nforce is a node.js salesforce REST API wrapper for force.com, database.com, and salesforce.com
MIT License
474 stars 167 forks source link

Deprecate query streaming. Replace with query arg. #78

Closed kevinohara80 closed 9 years ago

kevinohara80 commented 9 years ago

The query streaming functionality is being deprecated. It doesn't make a ton of sense to do this in a stream. In the future, I may implement a higher-level query plugin in the future that implements this but I'm not sure.

What's really needed is just a simpler way to fetch all records. This requires that nforce provides a way for the query method to fetch records recursively until the query limit is hit. A simple way of doing this is by adding a fetchAll argument...

// fetch up to 10,000 records
org.query({ query: 'SELECT Id .... LIMIT 10000', fetchAll: true }, function(err, records){
  console.log(records.length); // could be up to 10000 records;
});

// without fetchAll
org.query({ query: 'SELECT Id .... LIMIT 10000' }, function(err, records){
  console.log(records.length); // max 2000 records;
});
kevinohara80 commented 9 years ago

Implemented. To be released in 1.0