mongodb - Emberjs not returning all records -
i using sane stack, consists of sails , emberjs. using mongodb datastore.
when following on sailsjs side of things;
parent.find(req.query.id).populate('children').exec(function(err, parent){ console.log('children.length = ' + parent[0].children.length); });
i 212
but when following on emberjs side of things;
parent.get('children').then(function(children){ console.log('children.length = ' + children.length); });
i 30.
as matter of fact, once number of records goes on 30, not matter ember return 30 records.
is there way rest of records? need records can sort , calculate things. not displaying them.
any appreciated.
explanation
that's because default response limit in sails 30 records. it's there if have 10k or million rows don't make normal request , accidentally dump out entire database client , crash everything.
this documented here:
http://sailsjs.org/documentation/reference/configuration/sails-config-blueprints
defaultlimit (default: 30)
the default number of records show in response "find" action. doubles default size of populated arrays if populate true.
it's documented in config/blueprints.js
file in sails app: https://github.com/balderdashy/sails-generate-backend/blob/master/templates/config/blueprints.js#l152-l160.
here relevant code: https://github.com/balderdashy/sails/blob/master/lib/hooks/blueprints/actionutil.js#l291
solution
- edit
defaultlimit
inconfig/blueprints.js
file
or
- add
&limit=<number>
http request url
Comments
Post a Comment