You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As a developer of an API, I would like large collections streamed in chunks in order to minimize the memory footprint required to serve such requests.
Notes
Looks like Transfer-Encoding: chunked is already baked into express.js or node.js. However, looks like express.js is serializing json responses like this:
var body = JSON.stringify(obj, replacer, spaces);
Fortunately, looks like there is a stream-friendly mongoose api. Will just need to handle the serialization in crudify. JSONStream looks promising for that, but if not, can do it in crudify with something like this in sendResult.coffee:
res.send('[');
delim = '';
entity for entity in data
res.send(delim + JSON.stringify(entity))
delim = ','
res.send(']');
Tasks
Use the Mongoose.QueryStream API
Handle the serialization of ourselves instead of relying on express.js.
Summary
As a developer of an API, I would like large collections streamed in chunks in order to minimize the memory footprint required to serve such requests.
Notes
Looks like
Transfer-Encoding: chunked
is already baked into express.js or node.js. However, looks like express.js is serializing json responses like this:Fortunately, looks like there is a stream-friendly mongoose api. Will just need to handle the serialization in crudify. JSONStream looks promising for that, but if not, can do it in crudify with something like this in sendResult.coffee:
Tasks
References
The text was updated successfully, but these errors were encountered: