incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Black <>
Subject Re: Trying to wrap my head around CouchDB
Date Tue, 16 Jul 2013 20:22:10 GMT

On 07/16/2013 03:13 PM, Yves S. Garret wrote:
> On Tue, Jul 16, 2013 at 4:11 PM, Tim Black <> wrote:
>> To get all order documents in one request, write, then query, a view
>> which only emits documents if (doc.type == 'order').
As you learn about the way views and queries interact, you'll see that
another way to do the same thing, and perhaps reduce the size of the
view, is to make a view that emits just the doc.type as the 'key', then
send a query for ?key="order" or ?keys=["order"].

Also, CouchDB views are similar to MySQL table indexes - they pre-index
the data to speed up querying the data.  In MySQL you may not think
about indexes until you have to optimize; but in CouchDB you have to
write your views (maybe as optimally as possible) at the outset before
you query.

I'm attempting to learn how to query relational data in CouchDB using a
combination of backbone-couchdb and backbone-relational, which needed a
little patching to get them to work with each other.  One key to doing
this is to make sure I don't query for the whole data set, but rather
query for the smallest data set possible, before querying for the
related data, which is nearly the same strategy as optimizing slow MySQL


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message