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;
  });

/couchdb-creator/

    Package Sidebar

    Install

    npm i couchdb-creator

    Weekly Downloads

    1

    Version

    1.0.3

    License

    ISC

    Last publish

    Collaborators

    • unicodingunicorn