couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Mitchell <br...@strmpnk.co>
Subject Re: [PROPOSAL] new underscore namespacing
Date Tue, 03 Dec 2013 17:25:25 GMT
On Tue, Dec 3, 2013 at 10:35 AM, Volker Mische <volker.mische@gmail.com> wrote:
> I personally would prefer to have the meta information completely
> separate from the document. I know there have been discussion in the
> past to even have them separate in the backend (but that's not the point
> of this proposal).
>
> So the API for the view function could change to `function(doc, meta)`.
> This way you could store in your document whatever you like.

This is convenient in some cases but I really do like how CouchDB
documents are self-contained and self-representing. Having to rely on
an outside context to know things like identity and revision seems
unfortunate.

Most cases I've interacted with CouchDB would require at least that
minimal _id and _rev. Separating them might seem okay if you just look
at a map function with two arguments but it gets messier if you look
at client code in the applications that use CouchDB. Many do things
like:

    my_doc = db.get('doc')
    ...
    db.put(my_doc)

Juggling this context separately will require extra work or at least
force CouchDB clients to reinvent some way to wrap up and store
metadata. My experience writing client code against Riak, which
externalizes this metadata, was not nearly as clean as working with
CouchDB since everything needed some sort of wrapper where CouchDB
could many times get away with just a simple value.

On the side of internals, there is certainly some work to be done to
lift things in and out of this special field, but it could be done w/o
forcing clients to live with their world split in two.

Brian.

Mime
View raw message