update couch builder

This commit is contained in:
martind2000 2016-03-21 22:37:36 +00:00
parent 3d7770b294
commit bffd90d96c
2 changed files with 28 additions and 13 deletions

View File

@ -47,4 +47,14 @@ nano.db.destroy('keeper', function () {
*/ */
{
"getTagByKey": {
"map": function(doc) {
if (doc.tags.list.length > 0) {
for (var t = 0; t < doc.tags.list.length; t++) {
emit(doc._id, [doc.tags.list[t], doc.title]);
}
}
}
}
}

View File

@ -21,25 +21,30 @@ var tableList = [
} }
}, { }, {
name: '_design/taglist', view: { name: '_design/taglist', view: {
"taglist": {
"map": function(doc) { if (doc.type == 1) { emit(null, doc); } } "map": function(doc) { if (doc.type == 1) { emit(null, doc); } }
} }
}, { }}, {
name: '_design/getAllTags', view: { name: '_design/getAllTags', view: {
"getAllTags": {
"map": function(doc) { "map": function(doc) {
if (doc.tags.list.length > 0) { if (doc.tags.list.length > 0) {
emit(null, doc.tags.list); emit(null, doc.tags.list);
} }
} }
}
} }
}, { }, {
name: '_design/getTagByKey', view: { name: '_design/getTagByKey', view:{
"getTagByKey": {
"map": function(doc) { "map": function(doc) {
if (doc.tags.list.length > 0) { if (doc.tags.list.length > 0) {
for (var t = 0; t < doc.tags.list.length; t++) { for (var t = 0; t < doc.tags.list.length; t++) {
emit(doc._id, [doc.tags.list[t], doc.title]); emit(doc._id, [doc.tags.list[t], doc.title]);
} }
} }
} }
}
} }
} }
]; ];