I was wondering can you preform CRUD functionalities on CouchDB view that will update records in the db also?
I am building an PHP, Laravel application that uses CouchDB and views seem good solution as they load faster than DB tables.
I managed to read from the view but I wonder is it possible to add, delete and edit. This is first time that I am using Couch so I am not sure am I approaching this the right way.
No. Views in CouchDB are read-only versions of the data in the database (the same is true in most or all databases, including MySQL, Postgres, etc). To perform the C, U and D portions of CRUD, you need to use the rest of the CouchDB API.
To create or update, typically use PUT /{db}/{doc}
, and for delete, use DELETE /{db}/{doc}
.
You can batch updates with the _bulk_docs
endpoint, as well.