couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kowsik <kow...@gmail.com>
Subject Document subsets...
Date Wed, 15 Oct 2008 23:18:19 GMT
I have a large number of fairly large documents in the db and would
like to get at subsets (specific key/value pairs). In the interest of
latency and data transfer, I usually end up with numerous _design
views that slice and dice a given document and return the subset of
the documents. Instead of doing that, I'm thinking something like this
would be useful:

POST /<db>/_slice?id=blah
Content-Type: application/json
Content-Length: ...

function(doc) {
    emit({ key1: doc.key1, key2: doc.key2 });
}

where "blah" is the _id of the document. Invoking _slice without the
POST body is equivalent to doing "GET /<db>/<blah>" which returns the
entire document.

The big advantage is that once I end up with a docid using the normal
_design views, I can get at specific portion of the document without
necessarily writing numerous _design views. Since this just runs on a
given document, you don't incur the penalty of adhoc views.

Thoughts?

K.

Mime
View raw message