couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antony Blakey <>
Subject Re: Changing rev to _rev in view results (Was: Re: newbie question #1)
Date Wed, 31 Dec 2008 01:33:51 GMT

On 30/12/2008, at 1:40 AM, Robert Dionne wrote:

> With respect to a meta structure, I was going to make this comment  
> yesterday as I think Geir was arguing for this:
> It seems to me that occam's razor argues for the simplicity of a  
> single JSON doc, rather that a "metadoc" envelope that contains  
> another JSON doc embedded in it. It's not clear to me that creating  
> this separation of concerns buys anything at all. The use of an  
> underscore to designate distinguished fields at the top level is a  
> fairly easy convention to get your arms around.

That's not actually the issue. The issue is about having a single  
name, and not inventing a namespace technique for json docs. The  
choices are:

1. The current scheme of prepending _ to atom names when the atom is  
used inside a document. Con is the breakage of name identity, which  
has technical consequences as well as cognitive ones. Does the rule  
only apply at the top level of a document? What about future injected  
metadata that has internal structure?

2. Use '_' for all atoms, inside and outside documents. Con is the  
noise of extra underscores everywhere.

3. Don't use underscores inside documents - for id and rev at least,  
this wouldn't seem to be a big issue, but isn't future-proof if you  
want to handle other injected fields.

4. Use '_' for atoms that have to be injected, and make the name BE  
the '_' form. Con is that you have to decide in advance if an atom is  
going to ever be injected.

5. Use a '_meta' wrapper for the metadata. I don't see any technical  
cons, and IMO is by far the cleanest model. Name identity is  
preserved, it's arbitrarily extensible without scalability concerns,  
and is structural rather than lexical.

IMO option 5 is the best and cleanest solution.

Antony Blakey
CTO, Linkuistics Pty Ltd
Ph: 0438 840 787

One should respect public opinion insofar as is necessary to avoid  
starvation and keep out of prison, but anything that goes beyond this  
is voluntary submission to an unnecessary tyranny.
   -- Bertrand Russell

View raw message