Hitting result max when using too many query selectors
See original GitHub issueI’m running into an issue where a max of only 200 records are returned if several query selectors are being used. This is an issue for me since I’m selecting all attributes on the corresponding model within the ORM so that I don’t get back every field from salesforce. The issue can be reproduced by using the all selector '*'
. For example, assuming the Account
object has 450 records:
// This query will return all 450 records.
conn.sobject('Account')
.select('Id')
.execute(function(err, res) {
console.log('LEN: ' + res.length)
})
// However, this query will only return 200 records
conn.sobject('Account')
.select('*')
.execute(function(err, res) {
console.log('LEN: ' + res.length)
})
I’ve ran the query directly against SFDC API using all of the model attributes and it returns all records for me so something may be causing this issue within jsforce. I also checked on what lib/connection.js is sending to the API and it seems to build the HTTP request just fine. It’s possible that something is up with the post processing of the response body but I’m not entirely sure.
Issue Analytics
- State:
- Created 9 years ago
- Comments:10 (7 by maintainers)
Top GitHub Comments
To fetch all records automatically, you can use
autoFetch
option in query execution. In this case you should listen “record” event to manipulate returning records.I just ran into this issue as well using the event driven style. I tried @turakvlad 's suggestion of appending
,'*'
to myfind
, but it didn’t work. I couldn’t find any documentation on how to implement it, but it turns out this works.I don’t have more than 10K records to fetch, but setting
maxFetch
alone to a large number didn’t make any difference, removing it and only usingautoFetch
was enough for my needs, but I added themaxFetch
option anyway for a bit of future-proofing since I assume it will default to 10K.