couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Dionne <>
Subject Re: Changing rev to _rev in view results (Was: Re: newbie question #1)
Date Wed, 31 Dec 2008 12:37:52 GMT

On Dec 30, 2008, at 8:33 PM, Antony Blakey wrote:

> 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:

I understand the issue. I noted the use of _id versus id myself and  
wasn't that put off by it, just seemed a quirk of the implementation.  
I realize you've likely written a lot of code a this point and have  
run into reuse issues. It's not unusual to have different names for  
the same thing if the context is different.

> 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.

  It is clearly cleaner and has it's advantages, however I have to  
agree with an earlier poster; "Putting them in a _meta group might  
encourage aggregation and manipulation of the bookkeeping metadata  
separately from the document, which to me sounds like a recipe for  

   This would be a more complex design than the current use of the  
underscore at the top level of documents and would definitely  
encourage a quite different implementation. I don't know the  
internals enough yet to comment on this. The code there to date is  
remarkably terse for what it does but this may just reflect the use  
of Erlang.



> 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