This depends on how you design your database. What the documentation is saying there is that you can bulk insert docs straight up without any additional information.
On the other hand to update documents you would need to know their id's ahead of time. In the situation you describe where you are updating based on an attribute it's likely that even if you were using a naming convention for the doc._id, it wouldn't be readily available before updating. For situations like this I would create a view that emits category_id, select from the view, turn it into an object client side, update, then repost. I know that sounds crazy when you compare it to SQL, but from my experience you'll be much better off if you don't draw comparisons to SQL. You have to take a completely different mindset to application design. Things that may seem counter intuitive at first prove to be elegent in their simplicity in the long run. -Ross On Wed, Jul 8, 2009 at 1:55 AM, Vlad GURDIGA <[email protected]> wrote: > Hello! > > The CouchDB wiki says "CouchDB provides a bulk insert/update feature. > To use this, you make a POST request to the URI /{dbname}/_bulk_docs, > with the request body being a JSON document containing a list of new > documents to be inserted or updated." So, as far as I can understand, > this means that I first need to read the documents in order to bulk > update them. I wish I am mistaken. > > If I need to move products from one category to another, I would that > in SQL with a statement like this: > > UPDATE products SET category_id=1 WHERE category_id=2 > > Is there any way to do that in CouchDB? > > > Thank you! >
