couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kenneth Tyler <...@8thfold.com>
Subject Re: an aggregate object
Date Mon, 12 Apr 2010 21:44:21 GMT
Alexander,
I considered that. I didn't really give the full extent of what i need
to do. Each of my "related docs" might itself be a group of documents.
I want to save all changes to documents as new documents in the
aggregate group:

so if the group is:  docA, docB, and docC
then i might have docC1 and docC2

when the user edits docC i'd rather not have to go back to all the
other docs in the group and update their "related_docs" field... i'd
like to have a field in the new document that makes it part of the
"family" without have to update all the other documents in the family

thanks for the idea though

ken

On Mon, Apr 12, 2010 at 2:14 PM, Alexander Uvarov
<alexander.uvarov@gmail.com> wrote:
> 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