CouchDB and Ionic

Restricting Document Updates in CouchDB



·

CouchDB exposes a powerful REST API that allows you to interact with the database by making simple HTTP requests. The simplicity of CouchDB is one of its great features, but we might not always want to just blindly create or update documents.

Perhaps we want to check that a user can only modify their own documents, or perhaps we want to ensure that all documents conform to a specific format.

When using CouchDB, we can create something called a validate_doc_update function, which allows us to inspect incoming documents, and compare them to the previous version of the document. Within this function, we can create logic to determine whether to accept or reject a particular update.

In this video tutorial, we take a look at creating a basic validate_doc_update function in CouchDB.

Click here to watch the video on YouTube

What to watch next...