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

blue-cot

Package Overview
Dependencies
Maintainers
1
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

blue-cot

bluebird promise-based CouchDB library with no surprises (in a good way)

  • 3.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
16
increased by45.45%
Maintainers
1
Weekly downloads
 
Created
Source

Bluebird-based Cot fork

Installing

npm install blue-cot

Differences with Cot

  • Returns Bluebird promises
  • Class-less, thus a different initialization, but the rest of the API stays the same
  • Consequently, blue-cot is this-free: no need to bind functions contexts!
  • 4xx and 5xx responses will return rejected promises (should be handled with .catch)
  • Adds some view functions goodies

Initialization

const bluecot = require('blue-cot')
const config = {
  // MUST
  hostname: 'localhost'
  port: 5984,

  // MAY
  ssl: true
  // use one of the two:
  // together
  auth: 'username:password'
  // or separated
  user: 'username'
  pass: 'password'
  // logs the generated URLs and body
  debug: true
}

const getDbApi = bluecot(config)

const db = getDbApi('some-db-name')

API Reference

Those are the same than for cot-node. Just remember this difference in error handling: here, 4xx and 5xx responses from CouchDB will return rejected promises (should be handled with .catch)

  • docUrl
  • info
  • get
  • exists
  • put
  • post
  • batch
  • update
  • delete
  • bulk
  • buildQueryString
  • viewQuery
  • view
  • allDocs
  • viewKeysQuery
  • viewKeys
  • allDocsKeys
  • changes

View functions

To access those, pass a design doc name as second argument

const db = getDbApi('some-db-name', 'some-design-doc-name')
  • viewCustom
  • viewByKeysCustom
  • viewByKey
  • viewFindOneByKey
  • viewByKeys

see lib/view_functions

If you find this module useful, consider making a PR to improve the documentation

Keywords

FAQs

Package last updated on 14 Jan 2017

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