To retrieve the document(s) with doc_id
=10, you need to create a view with doc_id
as a key. Afair, you cannot enforce uniqueness of the doc_id
.
Instead of using your doc_id
, you could still use CouchDB's _id
field. Iirc, you do not have to leave it to CouchDB to assign a value to _id
. If you do not like the UUIDs CouchDB uses for the _id
field, you can create a document with an _id
you specify.
You need to be careful with that, esp. in a distributed setup. If you end up with different documents (on different nodes) having the same _id
, CouchDB might consider them to be different versions of the same document.