Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

then-couchdb

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

then-couchdb

A promise-based CouchDB client

  • 0.4.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

then-couchdb

then-couchdb is a promise-based CouchDB client for node.js. It supports all the features of CouchDB in a simple, user-friendly package.

Usage

Creating a client.

var couchdb = require('then-couchdb');
var db = couchdb.createClient('http://localhost:5984/my-database');

Save and fetch a single document.

db.save({ name: 'one' }).then(function (doc) {
  assert(doc);
  assert(doc._id);
  assert(doc._rev);

  db.get(doc._id).then(function (doc) {
    assert(doc);
    assert.equal(doc.name, 'one');
  });
});

Save and fetch many documents in bulk.

db.saveAll([
  { name: 'one' },
  { name: 'two' },
  { name: 'three' }
]).then(function (docs) {
  assert(Array.isArray(docs));
  assert.equal(docs.length, 3);

  var keys = docs.map(function (doc) {
    return doc._id;
  });

  db.getAll(keys).then(function (docs) {
    assert(Array.isArray(docs));
    assert.equal(docs.length, 3);
  });
});

Keywords

FAQs

Package last updated on 09 Apr 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc