CouchDB is a pretty amazing technology, but it is a little unique. With many data stores, you just query data. You can do that with CouchDB’s Mango queries, but CouchDB’s primary way to query data is by using views.
Views are pre-created, much like creating any document within CouchDB. After creating your view, you can query it using an
HTTP GET request.
You can use the Fauxton CouchDB UI to create a view.
A view has a few components. The first is the “
_id“. Everything in CouchDB has an “
type equal to
To run the query, we need to make an
HTTP GET request. For the example above, we would need to make the request to this URL:
As an interesting side note, views don’t have to have only one per document. We could have two views on a single document.