There are already many couchdb client in npm, and some of them are great projects, like nano, cradle, but still not implements the couchdb features that satisfied my needs in auth, view operations and flexibility. Some libs has fewer apis and failed to meet needs. Even some are not complete yet or not friendly to use.
There is always arguments that whether we really need a library for couchdb as it has rest apis. To me, if I'm working on a small project that read/write some documents from couchdb, I'm happy to work with http request lib like request.
But when your applications heavily depends on couch, you may want something that make code better orgnized rather than concating url strings in everywhere.
- Extendable via bind, to build your own apis
- Support view, lists and shows
- Chain for query paramters, easy and clean
- All the concepts (View, Document, etc.) are seperated, which make this lib support urls that get rewritted
- Treat DesignDoc the same as Document, you can do operations on DesignDoc
- Support Https, via request
npm install couch-db --save
Most of classes in this lib is accept an option object to let you configure the behaviors that how to request to the server.
All the options that you can pass to request, you can set here. So you can control whether use strictSSL, proxy yourself.
Is there any other additional options that is used by [couch-db][villadora/node-couchdb)?
None except one: request. The request options is let user to take full control of how to send request to the server, and of course, you have to follow the request api. Via this options, you can do cache layer to reduce request via modules like modified, or even intercept the response.
So except the request field, you can treat the options is the same as options in request.
You can go and see the doc there.
Create a couch server
var couch =server = ;/// orserver =;
var CouchDB = CouchDB;server = '';
Authenticate with username && password
Or you can utilize the session by login
Get a database
var db = server;
Or using bind:
server;var db = servercouch;// destroyserver;
You can extend database
Create database and insert new doc
var server = '';var db = server;db;
create new document with attachments
// new documentvar doc = dbtestdb;doc;
// existing documentvar doc = dbtestdb;// open to get revision or assign revision to the documentdoc;
add attachments with pipe
var d = doc;if !d assert;var s = fs;s;
See details in readthedocs
(The BSD License)
Copyright (c) 2014, Villa.Gao <firstname.lastname@example.org>; All rights reserved.