Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Streaming Queries #10

Open
wbyoung opened this issue May 10, 2015 · 0 comments
Open

Streaming Queries #10

wbyoung opened this issue May 10, 2015 · 0 comments

Comments

@wbyoung
Copy link
Owner

wbyoung commented May 10, 2015

For large data sets, it'd be nice to allow streaming data queries. For instance:

var query = Article.objects.where({ authorId: 5 });
query.on('data', function(article) {
  // handle single record
});
query.on('end', function() {
  // all records handled
});
query.execute().then(function(result) {
  expect(result).to.not.exist;
});

Because streaming would be used for large data sets, the expectation would be that when adding a data event handler, the query would no longer aggregate the results (consuming memory). We could make this something that you could disable:

var query = Article.objects.where({ authorId: 5 }).aggregate();
query.on('data', function(article) {
  // handle single record
});
query.execute().then(function(result) {
  expect(result).to.eql([article1, article2, article3]);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant