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

js-couchdb

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

js-couchdb

NodeJS REST library for CouchDB.

  • 1.1.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

couchdb.js

A Promise based ES6 library that provides an easy way to interact with CouchDB

Installation

Via NPM or yarn

npm install couchdb.js

yarn add couchdb.js

Usage

v1.1.0: On versions 1.1.0 and higher, all functions are OOP and attached to props on CouchClient. couch.listDatabases() => couch.databases.list(), etc.

couchdb.js exports a constructor that accepts an object with properties protocol, host and port. These should point to your couchdb server. They default to http, localhost and 3000 respectively.

// EXAMPLE
// Server points to localhost:5984
const { CouchClient } = require('js-couchdb');

// initialize the database
const db = new CouchDB({
    port: 5984
});

NOTE: Databases act like tables, and documents act like keys.

Creating a database

db.databases.create('stitch')
    .then(() => console.log('Succesfully created a DB!'));

Deleting a database

db.databases.delete('stitch')
    .then(() => console.log('Database deleted!'));

Creating a document

// first arg accepts the name of the database
// second takes in the ID
// third is the data to store
db.databases.get('stitch').then(db => db.documents.create('character', {
    disney: true,
    blue: true
})).then(() => console.log('Added a document!'));

Getting a document

database.documents.get('character');

TODO:

Better documentation.

Contribution:

To contribute to this package, fork the source and create pull requests. Be sure to follow the ESLint rules and code style.

Keywords

FAQs

Package last updated on 24 Jun 2018

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