Couch DB metadata

437 views
Skip to first unread message

d...@danmyersconsulting.com

unread,
May 9, 2012, 1:38:30 AM5/9/12
to us...@couchdb.apache.org
Can someone tell me or point me to documentation on how to view CouchDB's document metadata; how to add additional 'comments' at the document attribute level?
--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

Jens Alfke

unread,
May 9, 2012, 1:50:55 PM5/9/12
to us...@couchdb.apache.org

On May 8, 2012, at 10:38 PM, d...@danmyersconsulting.com<mailto:d...@danmyersconsulting.com> wrote:

Can someone tell me or point me to documentation on how to view CouchDB's document metadata; how to add additional 'comments' at the document attribute level?

There isn’t really any separate metadata for CouchDB documents. The metadata is simply a set of reserved document properties/attributes whose names begin with an “_”, such as “_id”, “_rev”, “_attachments”, etc.

If you want to add a comment-like attribute, just pick a new name that’s neither _-prefixed nor being used for any other purpose by users of your documents.

—Jens

bsquared

unread,
May 11, 2012, 12:32:48 PM5/11/12
to us...@couchdb.apache.org
"d...@danmyersconsulting.com"
<d...@danmyersconsulting.com> writes:

> Can someone tell me or point me to documentation on how to view CouchDB's document metadata; how to add additional 'comments' at the document attribute level?
You may consider a data-dictionary document for the db. Use it to store
meta-data for each document type.
--
Regards,
Brian Winfrey

d...@danmyersconsulting.com

unread,
May 11, 2012, 1:52:15 PM5/11/12
to us...@couchdb.apache.org
Brian, how do I do that in the database itself so other users can see it?
--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

Jens Alfke

unread,
May 11, 2012, 2:06:52 PM5/11/12
to us...@couchdb.apache.org

On May 11, 2012, at 10:52 AM, d...@danmyersconsulting.com<mailto:d...@danmyersconsulting.com> wrote:

Brian, how do I do that in the database itself so other users can see it?

CouchDB is freeform, remember. Just create a document with some pre-defined ID (like “attribute_metadata” perhaps) and store metadata in it in some pre-defined format.

(Or it might be better to store this in a new attribute of a design document, instead of your own document; in that case you’d need to pre-define the name of the design document.)

—Jens

bsquared

unread,
May 12, 2012, 12:47:30 PM5/12/12
to us...@couchdb.apache.org
"d...@danmyersconsulting.com"
The thought I had is to create a document in the db whose type is defined as
"data-dictionary". That document contains an array of document
definitions. You could then define views that enumerate the defintions.

{
"_id": DATA_DICTIONARY,
"_rev": "01",
"doc_type": "data_dictionary",
"document_definitions": {
"person_doc": {
"f_name": "string",
"m_name": "string",
"l_name": "string",
"birth_date": "date",
...
}
}
}

You may also want to look at kanso. It has an admin module which works
in conjuntion with a couch-types module to generate forms dynamically.
I think it could be used as an example to create a javascript solution.


http://github.com/kanso

--
Regards,
Brian Winfrey

Reply all
Reply to author
Forward
0 new messages