rethinkdb / rethinkdb

The open-source database for the realtime web.

Home Page:https://rethinkdb.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Will changefeeds eventually support `.count()` queries?

marshall007 opened this issue · comments

I understand the existing limitations of changefeeds in regards to commands that consume the entire stream, but is support for such queries on the roadmap?

In one of our applications we have long-running jobs that are started in a separate process and insert documents as they go. After starting one of these jobs, I need to notify clients of its progress (from the main process) by monitoring the number of documents that have been inserted thus far.

r.table('job_results').getAll(job_id, { index: 'job_id' }).count().changes()

I currently handle this by polling and was looking forward to not having to do that anymore after 1.16. As a workaround I will probably watch for changes on the .getAll(...) and manually increment a counter when I see new values.

is support for such queries on the roadmap?

Yes, it is! It isn't scheduled for a release yet, but long-term you should be able to call changes on any reduction (so .count.changes, .sum.changes, .avg.changes, and reversible instances of .reduce.changes).

This is part of #1118