incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fink Mark <m...@mark-fink.de>
Subject some guidance for couchdb views
Date Sat, 26 Dec 2009 14:05:23 GMT
Hi there,

I am new to couchdb and currently stuck with the sample app I am working on.

I managed to put some data into couchdb, for example:
File    CountLineCode    SumCyclomatic    RatioCommentToCode
content/events/src/nsQueryContentEventHandler.cpp    432    226    0.12
content/events/src/nsXMLEventsElement.cpp    47    11    0.79
content/events/src/nsXMLEventsManager.cpp    352    94    0.15
content/html/content/src/nsClientRect.cpp    82    35    0.48
content/html/content/src/nsFormSubmission.cpp    813    187    0.49
content/html/content/src/nsGenericHTMLElement.cpp    2652    646    0.13
content/html/content/src/nsHTMLAnchorElement.cpp    456    132    0.18
content/html/content/src/nsHTMLAreaElement.cpp    365    101    0.16
content/html/content/src/nsHTMLAudioElement.cpp    43    26    1.02
(every row is put into its own document)

Now I want to query the datastore using map/reduce views. The reduce
function should add the values for a given key (keys are part of the file
value). For example a query for
"content/html/content/src/nsFormSubmission.cpp" would result into
"CountLineCode":  813, "SumCyclomatic":  187, "RatioCommentToCode": 0.4. A
query for "content/html/" would add the values where File matches the given
prefix. "content/" would add more and "" would add the values of all
documents.

I feel that this is exactly what couchdb is good at and I think there is a
very simple solution to this. Unfortunately I do not have much practise with
the map reduce functions and I need some help. Maybe there is tutorial
available to help with similar path oriented views?

Maybe I got it all wrong and should put all the lines above into one single
document. I had this before but futon stopped working nicely because the
document had about 5000 lines. I think in this scenario I could not even
apply the map reduce functions. I have to traverse the document by myself.
What do you think?

regards,
Mark

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