Chapter 8. Using CouchDB with OpenWhisk
In the first part of the book, when we were developing our contact form we actually used a database to store data. At the time, we didn’t go into much detail about how the database works, because the focus of the first part was understanding OpenWhisk.
But at this point, we need to know more about how to use a database since data storage is a key component of every nontrivial application.
Or course, we can’t possibly cover every single database out there—we have to choose one. OpenWhisk offers a package that integrates with the Cloudant and CouchDB databases, NoSQL databases based on JSON that fit the JSON-based paradigm of OpenWhisk pretty well, so the choice is obvious.
Note
Cloudant is an IBM product, a cloud-based NoSQL database offered as a software service in the cloud. Cloudant is based on the open source Apache project CouchDB, which can be deployed into on-premises deployments of OpenWhisk. OpenWhisk is not bound to Cloudant, since you can also use CouchDB. Everything in this chapter applies to both Cloudant and CouchDB. For simplicity, in the rest of the chapter I’ll talk about CouchDB, but it also applies to Cloudant.
CouchDB is a good match for OpenWhisk because it is JSON based, it is schemaless, and it is scalable.
Let’s discuss those points. First, all the actions in OpenWhisk talk to each other and exchange JSON objects. Hence, JSON is the natural format for managing data. The obvious requirement in similar environments ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access