Over the past few weeks, I’ve been working on writing a series of tutorials on how to use CouchDB and PouchDB in Ionic 2. This video tutorial is sort of an aside to that – I wanted to create a demonstration of creating CouchDB databases and playing around with the data a bit, just to help paint a picture of what working with CouchDB actually looks like.
Here’s the video:
- Once you have CouchDB installed, you can access Futon which provides an interface to manage your CouchDB databases
- CouchDB doesn’t require any predefined schema, you can store data in any way you wish and change it at any time (you should still put effort into planning an efficient data structure, though)
- To store data for a blog (posts and comments) we could store each post and comment as its own document (but that is not the only way to do it)
- We can link a comment document to a post document by adding a field to the comment that references the
idof the post
- We can create views in CouchDB using MapReduce functions to query data (like grabbing all of the blog posts sorted by date, or grabbing all of the comments for a particular blog post)