0.1.1 • Published 8 years ago

couch-configure v0.1.1

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

couch-configure

A simple set of utilities that sit on top of Nano for interfacing with couchDB.

Installation

npm i --save-dev couch-configure

Nano Functions

The following functions work just like thier Nano counterparts, except they return a promise and reject on err:

fetch

merge

replace

head

insert

update

Additional Functions

initialize

Initialize will set up Nano to authenticate to the couchdb. Pass in the couchdb url, username, pass and database name.

couchdb.initialize("http://localhost:5984", "admin", "pass", "database").then(function (response) {
}, function (reason) {
});

merge

Merge will get the latest document matching the _id of your new document. Then it will copy over the top level properties from your object into the document and update it. No _rev is needed.

 couch.merge ({_id: "19191", name: "Steve"}).then( function (body) {
        console.log(JSON.stringify(body));
    }, function (err) {
        console.log(err);
    });

replace

Input a document with an _id to update. Replace will get the latest revision and update it with the input document. No _rev is needed.

couch.replace({_id: "19191", name: "Steve", weight: "130"}).then( function (body) {
        console.log(JSON.stringify(body));
    }, function (err) {
        console.log(err);
    });

delete

Input a document Id as the key and delete will delete the latest rev of this document. No _rev is needed

couch.delete("19191").then( function (body) {
        console.log(JSON.stringify(body));
    }, function (err) {
        console.log(err);
    });
0.1.1

8 years ago

0.1.0

8 years ago

0.0.19

9 years ago

0.0.18

9 years ago

0.0.17

9 years ago

0.0.16

9 years ago

0.0.15

9 years ago

0.0.14

9 years ago

0.0.13

9 years ago

0.0.12

9 years ago

0.0.11

9 years ago

0.0.10

9 years ago

0.0.9

9 years ago

0.0.8

9 years ago

0.0.7

9 years ago

0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago