Are changes stored forever?

I am considering using Couchbase for an app that we are developing. It will be storing changes regularly and will need to sync those changes to mobile clients. From what I have read all this should be fine. From what I understand, all changes to a document are stored and a client either receives a feed of changes or long polls for any changes newer than the locally cached revision.

My problem is that as far as I can see, these changes are stored forever and some of my documents might change a few million times and I might have a few million users so I am looking at a huge buildup of “redundant” data to store as I really do no need to be able to access previous versions of any records.

So what I want to know if there is a way to only store a certain amount of changes and force clients to re-fetch records if their local records are to old?

Hi Gerhard!

Couchbase does store the whole change history of a document, only the latest one. The mobile client will always try to fetch the latest version of a document and in case of a conflict (the document was changed at the same time in the remote server and in the mobile client) you can use Sync Gateway to solve it.

The use case you mentioned is exactly one of the scenarios where Couchbase is mostly used for.

Hi Denis

I don’t quite follow, are you saying that it stores all changes or only the latest version? Or are you saying all changes and the latest full document?

If it stores all the changes though, will I just need to accept that I have to pay for enough storage to store a few million changes per record even though I have no intention of ever intentionally reviewing the history?

My Bad, I had a typo in my previous response.

Couchbase only stores the latest version of a document

1 Like