On Dec 28, 2008, at 8:58 AM, Geir Magnusson Jr. wrote:
On Dec 28, 2008, at 8:46 AM, Paul Davis wrote:
On Sun, Dec 28, 2008 at 8:32 AM, Geir Magnusson Jr.
<[email protected]> wrote:
On Dec 28, 2008, at 8:19 AM, Noah Slater wrote:
On Sun, Dec 28, 2008 at 08:12:10AM -0500, Geir Magnusson Jr. wrote:
I've had this debate internally at 10gen too, and I'm not
interested in
picking a fight here :) I think that by reserving fields like
this, you
can't
claim to be storing JSON anymore, but "JSON--" or "almost JSON".
I think this is bogus. I've started calling these JSON profiles
and they
are
just as much JSON as an XML vocabulary is a type of XML.
<sigh> :)
I didn't want to start this argument.
My point is that an arbitrary, legal JSON document can have "_id"
and "_rev"
as fields, but you couldn't store that in CouchDB (or MongoDB, for
that
matter), since CouchDB would want to use those reserved field
names for
itself.
To say that reserving underscore prefixed fields for CouchDB use is a
violation of rfc4627 [1] is provably false.
That's not what I said. The documents that CouchDB produces for
storage are legal JSON.
What I said was that you couldn't store an arbitrary, legal JSON
document from a user with fidelity in CouchDB.
The following two documents are legal JSON documents, but CouchDB
can't store them (if I grok CouchDB right) :
{
"_id" : "geir's document",
"foo" : "bar"
}
{
"_id" : "geir's document",
"foo" : "woogie"
}
Sure you can:
{_id:"the actual id",
body:{
"_id" : "geir's document",
"foo" : "bar"
}
}
If you need to store underscore fields, store move the whole document
down from the top level into another field.
This doesn't just apply to _id and _rev, there are other meta fields
that can be returned in a doc, and those will also have underscores.
The rule is reserved fields in document root start with underscore.
User fields at the doc root level cannot start with underscore.