开发者

How to disable versioning in CouchDB?

开发者 https://www.devze.com 2023-03-14 12:41 出处:网络
I know sometimes it\'s a good feature, but if i need to store large amount of data, it\'s unnecessary other \"meta-data\" around the da开发者_如何学运维ta itself.

I know sometimes it's a good feature, but if i need to store large amount of data, it's unnecessary other "meta-data" around the da开发者_如何学运维ta itself.

Is there any way how to disable versioning in CouchDB, or do i need to use different DB engine, like Mongo?


Versioning isn't a feature of CouchDB it is a core function of the way it works writing the data to the disk and preforms replication conflict resolution with other nodes. It is not a history mechanism.

It is very unfortunate that there isn't a better term than version for referring to the previous copies of the documents. Because version to most developers means something historical that is warehoused. That isn't what it is intended to be used as at all in CouchDB.

It is plastered all over the CouchDB documentation to not rely on previous versions as backups or a versioning system, that they can potentially disappear at anytime, because they are used for replication conflict detection mainly. But the simple fact is this isn't a feature it is just how CouchDB works.

The only way to remove the past versions is to compact the database periodically. In the current version of CouchDB this can be enabled with a script that hooks into document updates and fires off semi-automatic compaction based on a high water mark threshold. Usually this is done manually after a large set of documents are updated in a batch a you know that this might be beneficial from an application specific standpoint.

That said, if you aren't updating documents no history is generated and this is not needed.


You may try _revs_limit API (e.g. /database/_revs_limit). I have never used it I just read about it on this link http://wiki.apache.org/couchdb/Security_Features_Overview


Couchbase single server 2.0 developer preview has automatic compaction among other features and improvements which should be also present in the future versions of CouchDB as well. This can help you to get rid of older document versions automatically based on some settings.

0

精彩评论

暂无评论...
验证码 换一张
取 消