Miss any of our Open RFC calls?Watch the recordings here! »

couchdb-creator

1.0.3 • Public • Published

couchdb-creator

Utility for dynamically check for, and creating if their existence is doubtful, a specified DB in CouchDB via nano. Intended for stuff like Docker containers where one is unable to create the DB manually via Futon or the like.

Usage

  var nano = require("nano")("http://couchdb:5984");
  var creator = require("couchdb-creator");
 
  var foo;
  creator(nano, 'foo', function(db){
    foo = db;
  });

With design_doc:

  var nano = require("nano")("http://couchdb:5984");
  var creator = require("couchdb-creator");
 
  var doc = { "views":
      { "by_name_and_city":
        { "map": function(doc) { emit([doc.name, doc.city], doc._id); } }
      }
    };
  var foo;
  creator(nano, 'foo', {name : 'by_name_and_city', doc : doc}, function(db){
    foo = db;
  });

Keywords

Install

npm i couchdb-creator

DownloadsWeekly Downloads

0

Version

1.0.3

License

ISC

Last publish

Collaborators

  • avatar