How to design a customized history bucket for logging every document changes


#1

What i need is a feature to recover document to any version in the known time period.
So i plan to create a history table to record like:

listened recored:
{key:'uuid-01',content:{'name':'Chopper'}
history recored:
{'time':'2016-01-19 10XXXX',dataKey:'uuid-01',dataContent:'{"name":"Chopper"}',operateMethod:'ADD'}
{'time':'2016-01-19 11XXXX',dataKey:'uuid-01',dataContent:'{"name":"Chopper01"}',operateMethod:'UPDATE'}

cause the history bucket only push information, so it is getting bigger and bigger, so i don’t know how to handle it. And i begin to think my solution is not a good one, could any one give me some advise about it ? thanks for reading.


#2

If you are looking into Event-Driven architecture, you might be better of with Kafka. You might be able to use Couchbase DCP too. @shane can probably tell you more.


#3

Thanks for ur solution, i have not planed to use Kafaka yet. And i already have a trigger in my code to invoke when document updated, which is not DCP. So maybe i will change to use DCP after do some benchmark testing.
My question is whether i use DCP or not, i still need a listener bucket to record data change information from origin bucket, so is there some better idea to just push/add data to listener bucket, and how to handle when this bucket is get bigger and bigger?