This commit is contained in:
Martin Donnelly 2016-03-21 16:47:08 +00:00
parent e5334cc5e7
commit 3e24bbd22f

View File

@ -3,6 +3,51 @@ var nano = require('nano')('http://localhost:5984');
var db_name = 'keeper';
var keeper = nano.use(db_name);
alice.destroy('_design/titles', function(err, body) {
if (!err)
console.log(body);
});
alice.destroy('_design/reducedView', function(err, body) {
if (!err)
console.log(body);
});
alice.destroy('_design/taglist', function(err, body) {
if (!err)
console.log(body);
});
alice.destroy('_design/getAllTags', function(err, body) {
if (!err)
console.log(body);
});
alice.destroy('_design/getTagByKey', function(err, body) {
if (!err)
console.log(body);
});
keeper.insert(
{
"views": {
"titles": {
"map": function (doc) { emit(null, doc.title); }
}
}
}, '_design/titles', function (error, response) {
console.log("_design/titles added");
});
keeper.insert(
{
"views": {
"reducedView": {
"map": function (doc) { emit(null, [doc.title, doc.reduced]); }
}
}
}, '_design/reducedView', function (error, response) {
console.log("_design/reducedView added");
});
keeper.insert(
{
"views": {