couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Gabriel <>
Subject Re: How to get hierarchicaly linked data into one line?
Date Mon, 07 Nov 2011 00:40:09 GMT
Hi Aurelien

Thanks for helping.

I have tried to collate the lines of hierarchically linked documents now.
This is what my view looks like:
*function(doc) {*
*    var User = doc.User;*
* if(doc.Typ == 'Projekt'){*
* emit ([User, doc._id, {}, {}, {}, {}], doc);*
* } else if (doc.Typ == 'Raum') {*
*    emit ([User, doc.ProjektId, doc._id, {}, {}, {}], doc);*
*    } else if (doc.Typ == 'Ort') {*
*    emit ([User, doc.ProjektId, doc.RaumId, doc._id, {}, {}], doc);*
*    } else if (doc.Typ == 'Zeit') {*
*    emit ([User, doc.ProjektId, doc.RaumId, doc.OrtId, doc._id, {}], doc);*
*    } else if (doc.Typ == 'Art') {*
*    emit ([User, doc.ProjektId, doc.RaumId, doc.OrtId, doc.ZeitId,
doc._id], doc);*
*    }*
The hierarchies are: Projekt, Raum, Ort, Zeit and Art.

In the Output of the list linked lines follow each other now. Thats as good
as I could expect this sort of List to become. It would be great to build a
tree view: (note: I deleted most fields)
[image: image.png]

The Result is not what the Users will expect though: Although every line
contains the id's of all hierarchies, only one contains the attributes of
it. You will have some work to see visually what are the attributes of the
Projekt (higher order hierarchy) of a Art (lowest order hierarchy). You
can't filter the table by an attribute of a Projekt (higher order
hierarchy) and get all its lines (sightings of species).

That is why I am searching for a method to get the data of all hierarchies
on one single line per sighting (lowest order or hierarchy).

Thanks a lot though for helping me get this far.


2011/11/6 Aurélien Bénel <>

> Hi Alexander,
> > But I can't figure out how to create a view/list with all the data of a
> sighting on one line. This would be easy with a relational database. I must
> be missing something. I've seen this (
> but it puts related data on neighbouring lines.
> You don't have to put them on the same line.
> When you query a view, you don't get just a line, but all the lines that
> corresponds to the key or to the range of keys you gave.
> This means that you can "collate" lines coming from different documents :
> Regards,
> Aurélien

  • Unnamed multipart/related (inline, None, 0 bytes)
View raw message