Reputation: 3096
I would like to update all documents where doc.type = "article"
.
From what I understand _bulk_docs
works on all documents. To narrow down affected docs one can use key value/range.
This is not ideal because I have different types of documents in database. I hoped I can update all documents returned by a view but it seams to be not possible (please correct me if I'm wrong).
The only solution I can think of is prefixing all keys with document type but is that a reasonable approach?
Upvotes: 0
Views: 220
Reputation: 4743
You could
doc.type == "article"
-- you'd probably use a view for this_bulk_docs
If the number of documents matching your criterion are too large to fit in a single request, you'd have to make multiple requests to _bulk_docs
. Also doing this could introduce conflicts that you'd have to resolve afterwards.
Upvotes: 1
Reputation: 13570
There is no way of doing this in CouchDB. Moreover, there is not much sense in doing this, since in CouchDB you can only update whole document, not just some properties. So if you is was possible to achieve what you want, it would make all the documents identical.
Upvotes: 2