var nano = require('nano')('http://localhost:5984'); // clean up the database we created previously nano.db.destroy('logger', function() { // create a new database nano.db.create('logger', function() { // specify the database we are going to use var keeper = nano.use('logger'); // and insert a document in it keeper.insert( { "views": { "body": { "map": function(doc) { emit(null, doc.body); } } } }, '_design/body', function (error, response) { console.log("_design/body added"); }); /* 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"); }); */ }); });/** * Created by Martin on 02/03/2016. */