Reputation: 2517
I am working on couchdb with nodejs where I have requirement where my document is added once and only once. I think there is no need of _rev tag in my Document. As _rev value is long string and my data is very small it adds a big overhead and finally big document size. I am aware it is very integral part of couchdb but in some typical cases it becomes redundant. NOTE I also know that couchDB uses Multi-Version Concurrency Control (MVCC).
My point here is in short :
can I have entry like
"_id": "001" "value":"12"
"_id": "002" "value":"23"
where there is no such value as "_rev": "1-8b0b70974c6dd43edf4e07f12a9655af"
Upvotes: 1
Views: 522
Reputation: 111366
It is impossible to disable revisions in CouchDB. Revisions are the integral part of the database. If you are sure that you don't want them then you may want to use some other database but if you use Mongo then it will store revisions. But look at it this way: if you have a requirement that your documents never change then how are you going to guarantee that? A revisions seems like a perfect feature to make sure that your documents never change. Not only because you can read them but also because if you never use them then you will not be able do update any document for which a previous revision is needed for updates.
Upvotes: 1
Reputation: 28429
If you don't want the _rev
property transmitted when downloading a document, you can always use a show function to transform your document's JSON to exclude this property:
function (doc, req) {
delete(doc._rev)
return { json: doc }
}
This does mean you have to use the show function API instead of fetching the document directly, but you can use this approach to apply other domain-specific optimizations.
Upvotes: 1