You need view collation Emit both within the same view, using the filename as the key and a type identifier to discriminate between comments and the original content: function(doc) { if (doc. Type == "PageType") emit(doc. Filename,0,doc.
Content); if (doc. Type == "PageCommentType") emitdoc. RefFilename,1,doc.
Content); } When looking for the document demo and its comments, run a query with startkey="demo",0 and endkey="demo",1 : you will get the page content followed by all the comments Once you have all the data you want, but it's not in the right format you are almost done. Simply write a list function to read all the rows and output the final JSON document with the structure/schema that you need.
You need view collation. Emit both within the same view, using the filename as the key and a type identifier to discriminate between comments and the original content: function(doc) { if (doc. Type == "PageType") emit(doc.
Filename,0,doc. Content); if (doc. Type == "PageCommentType") emitdoc.
RefFilename,1,doc. Content); } When looking for the document demo and its comments, run a query with startkey="demo",0 and endkey="demo",1: you will get the page content followed by all the comments. Once you have all the data you want, but it's not in the right format, you are almost done.
Simply write a _list function to read all the rows and output the final JSON document with the structure/schema that you need.
Did you mean doc. Comments for the second emit? – Wayne Conrad Jan 24 at 23:07 this two rows result I managed, but it's not what im looking for.
I wanted to have aggregated document that has comments attribute which is array of documents emitted of type PageCommentType... in earlier versions of CouchDb as I recall there was some way to call map within map function and somehow wrap it, but I just can't figure out how it works now... – Skitsanos Jan 24 at 23:57 Sometimes if I hear "aggregated," that is a clue to reduce from the map/reduce views. Unfortunately, reducing is not going to work here because you are accumulating data rather than reducing it. (In other words, you'll get an error that the reduce size is too big.) I will amend Victor's answer with some ideas.
– JasonSmith Jan 25 at 3:23 Aggregation not necessary means what you had in mind, it's about collecting data and spitting it in certain format, this is why I was specific in my question on how I want to see my data, so Vistor's answer is not fitting here, because what he suggests will spit resultset like {"total_rows":4,"offset":0,"rows":} where rows array will have first element as my document of PageType and rest of the array items will be PageCommentType -- this is too simple, totally not what i'm looking for... – Skitsanos Jan 25 at 10:24 @Skitsanos: in that case, use a _list function as suggested by jhs' edit to transform the resultset into a more appropriate format. – Victor Nicollet Jan 25 at 10:39.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.