add podcasts/license view
authorStefan Kögl <stefan@skoegl.net>
Mon, 17 Jun 2013 16:24:35 +0000 (17 18:24 +0200)
committerStefan Kögl <stefan@skoegl.net>
Mon, 17 Jun 2013 16:24:35 +0000 (17 18:24 +0200)
couchdb/general/_design/podcasts/views/license/map.js [new file with mode: 0644]
couchdb/general/_design/podcasts/views/license/reduce.js [new file with mode: 0644]

diff --git a/couchdb/general/_design/podcasts/views/license/map.js b/couchdb/general/_design/podcasts/views/license/map.js
new file mode 100644 (file)
index 0000000..1157005
--- /dev/null
@@ -0,0 +1,22 @@
+function(doc)
+{
+    if (doc.doc_type == 'Podcast')
+    {
+        if(doc.license)
+        {
+            emit(doc.license, null);
+        }
+    }
+    else if(doc.doc_type == 'PodcastGroup')
+    {
+        for(var n in doc.podcasts)
+        {
+            var podcast = doc.podcasts[n];
+            if (podcast.license)
+            {
+                emit(podcast.license, null);
+                return;
+            }
+        }
+    }
+}
diff --git a/couchdb/general/_design/podcasts/views/license/reduce.js b/couchdb/general/_design/podcasts/views/license/reduce.js
new file mode 100644 (file)
index 0000000..c866cd7
--- /dev/null
@@ -0,0 +1 @@
+_count