couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Uvarov <alexander.uva...@gmail.com>
Subject Re: an aggregate object
Date Mon, 12 Apr 2010 21:14:58 GMT
Why not just create the following:

{
    "_id": "some_id_3",
    "type": "Page",
    "text": "Some text",
    "related_docs": ["some_id_2, "some_id_3"]
}

{
    "_id": "some_id_2",
    "type": "Image",
    "size": "1024x768",
    "title": "Nice chick"
}

{
    "_id": "some_id_3",
    "type": "Movie",
    "duration": "600",
    "title": "Cool movie"
}

And store actual image and movie as attachment.

Use this guide http://blog.couch.io/post/446015664/whats-new-in-apache-couchdb-0-11-part-two-views
to retrieve Content and related documents in 1 query.

On 13.04.2010, at 2:59, Kenneth Tyler wrote:

> this may sound a little strange
> 
> i am trying to build up a "content" object that can contain several
> kinds of files.
> 
> for example, it might contain a some text, and an image, and a video clip
> 
> i want to tag my documents in couch so that i can retrieve the whole
> "family" of documents
> 
> so i use a field called "name" and i put the uuid generated for the
> first document in the family into that field in all the documents i
> want to belong to the content "family".... i add that documents own
> uuid as the second part of the "name": 89ehjwol8e7/7896w89e6r
> 
> i this case we would have documents T I AND V, and they would all have
> "names" with the same uuid at the beginning of the string
> 
> so i can make a view with the "name" fields as the key and get back
> all three documents by using a regular expression that looks for the
> common head of the string in all the name fields
> 
> .....
> it gets more complicated later... but first i wanted to check and see
> if this approach "fits" with the way couchdb "wants" things to be done
> 
> i love couch... i really think its going to be huge.... i'm coming
> from a ms access application developer background... so a lot of stuff
> is strange at first... and i have a lot of "relational" habits about
> how i think about data
> 
> thanks
> 
> ken tyler


Mime
View raw message