Read all docs via Native API


I have two docs Customer and Journal within same database (Couchbase Lite).

What would be the best approach to read all Journal docs without reading the Customer doc?



Here is a brief overview of how to query your data with map/reduce views in CBL.


The convention is to use a property named type with a string value that distinguishes the two, like "type":"customer" and "type":"journal".

You can then easily create views with map functions that only emit keys for docs of the appropriate type. The keys can be whatever you want to index — maybe the doc ID but maybe some other attribute. For instance the customer ID, if you want to sort by that or query ranges of them.


Thank you all for the answers. It was very helpful.