Which, if any, of the NoSQL databases can provide stream of *changes* to a query result set?

couchdb, mongodb, nosql, redis, riak

Solution

Although an answer has been accepted, there is another answer that gets to the heart of the assumptions underneath your question.

What is the business concern that you have related to getting a list of changes to the data? What if, instead of merely getting the list of changes to the data, you received a set of events that told you why and how the data changed.

This concept is one of the fundamental reasons behind "CQRS" as an architecture. Basically you store all events that caused a change to your data, e.g. FundsDeposited, FundsWithdrawn, etc. and you gain the ability to "replay" those events and discover not just how your data changed over time, but why.

Once you go down that road, you gain the ability to store events as a stream and you are no longer limited to a small handful of storage engines. Instead you could literally use any storage engine and it would get the job done.

Problem

Which, if any, of the NoSQL databases can provide stream of changes to a query result set? Could anyone point me at some examples? Firstly, I believe that none of the SQL databases provide this functionality - am I correct? I need to be able to specify arbitrary, simple queries, whose equivalent in SQL might be written: ``` SELECT * FROM accounts WHERE balance < 0 and balance > -1000; ``` I want an an initial result set: ``` id: 100, name: Fred, balance: -10 id: 103, name: Mary, balance: -200 ``` but then I want a stream of changes to follow, forever, until I stop them: ``` meta: remove, id: 100 meta: add, id: 104, name: Alice, balance: -300 meta: remove, id: 103 meta: modify, id: 104, name: Alice, balance: -400 meta: modify, id: 104, name: Alison, balance: -400 meta: add, id: 101, name: Clive, balance: -200 meta: modify, id: 104, name: Alison, balance: -100 ... ``` Note: I'm not talking about streaming large result sets. I'm looking for a soft-realtime stream of changes. Also, it needs to scale out, if possible. Thanks, Chris.

Original source