On Dec 28, 2008, at 9:36 AM, Damien Katz wrote:


On Dec 28, 2008, at 8:58 AM, Geir Magnusson Jr. wrote:


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.

I understand that, but that's really my point - I need to change my document if I want to store it in CouchDB. People don't seem to care though :)


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.

Yep - that was clear in the docs.

geir

Reply via email to