Lesson 18

Filtering Data from CouchDB

Improve efficiency by only syncing required data

PRO

Lesson Outline

Filtering Data from CouchDB

We can automatically sync data from our remote CouchDB database to our local PouchDB database, which is pretty cool. But there could be some problems that arise from that. If it's a small enough amount of data then there won't be an issue, but what about when the application is two years old and maybe 300,000 chat messages have been sent? You probably don't want to keep the entire CouchDB database replicated to the local PouchDB database.

We've covered creating views with map functions, and validate_doc_update functions, but now we are going to use yet another function with CouchDB to create a filter. This will allow us to filter the data that we want to replicate. What you want to replicate is going to depend on the application, but we are going to walk through implementing a filter that will only replicate documents from the last week.

The filter we create in CouchDB is going to look like this:

PRO

Thanks for checking out the preview of this lesson!

The full version of this lesson is only available to pro members. If you would like full access to this module and all of the other pro modules on Elite Ionic you can become a pro member (or log in if you are already a member).