- Source Code & Resources PRO
- Lesson 1: Introduction PUBLIC
- Lesson 2: Application Requirements PUBLIC
- Lesson 3: A Brief Introduction to NoSQL PUBLIC
- Lesson 4: Introduction to CouchDB PRO
- Lesson 5: Introduction to PouchDB PRO
- Lesson 6: Structuring Data in CouchDB PRO
- Lesson 7: Installing CouchDB Locally PRO
- Lesson 8: Adding Data to Futon PRO
- Lesson 9: Starting the Application PRO
- Lesson 10: Setting up the Basic User Interface PRO
- Lesson 11: Using Design Documents to Create Views in CouchDB PRO
- Lesson 12: Getting Data From CouchDB into Ionic PRO
- Lesson 13: Using Node, Express, and SuperLogin PRO
- Lesson 14: Login and Registration PRO
- Lesson 15: Offline Access and Reauthentication PRO
- Lesson 16: Advanced Form Validation PRO
- Lesson 17: Restricting Document Updates PRO
- Lesson 18: Filtering Data from CouchDB PRO
- Lesson 19: Improving User Experience PRO
- Lesson 20: Migrating to Production PRO
- Lesson 21: Conclusion PRO
We've covered the basics of what CouchDB is and why we are going to be using it to build this application, but I've also mentioned another technology called PouchDB. In this lesson, we are going to cover what PouchDB is, why we would want to use it, and how it differs to CouchDB.
You can run a PouchDB database in complete isolation if you want to. If all you are interested in is local data storage, but the requirements of your application would benefit from a CouchDB style document database, you can just install PouchDB and use it locally. In this scenario, it would be similar to using Ionic's Storage API, just with a lot more functionality (Ionic's Storage API is more like a simple key-value NoSQL database, whereas PouchDB would provide us with a fully featured document based database).
Although PouchDB and CouchDB are two different things, any database that uses the CouchDB protocol can be easily synced to any other database that uses the same protocol.
We can easily sync a local PouchDB database to a remote CouchDB database. Syncing means that any changes made to the local PouchDB database will automatically be reflected in the remote CouchDB database, and any changes made to the remote CouchDB database will be reflected in the local PouchDB database. This isn't just limited to two databases either, you could have any number of local PouchDB databases synced to any number of remote CouchDB databases.
When building an Ionic application, the two most noticeable benefits of using a local PouchDB database (instead of just interacting with a remote CouchDB database) will likely be:
- The ability to provide offline data access with online syncing
Another key benefit of the PouchDB/CouchDB combo is data persistence/fault tolerance. Since we can set up a remote CouchDB database that data is synced too, we don't need to worry too much about the data on a user's device being wiped - as soon as the user syncs back to the network it can start pulling the appropriate data back in. The same goes for the CouchDB database itself, if we have multiple CouchDB databases syncing to each other from multiple different locations the loss of any one (or multiple) databases isn't usually a big deal.