New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

couchdb

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

couchdb

  • 0.3.8
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

CouchDB Client

CouchDB-CommonJS is a promise-based CouchDB client. It can be used in the browser or on the server via Node.js.

Example Usage in Node.js

Create a module named hello-couch.js and add the following code:

var couchdb = require('couchdb');
var client  = couchdb.createClient(5984, 'localhost');
var db      = client.db('helloCouch');

var doc = { _id: 'helloCouch', text: 'Hello CouchDB!' };

db.saveDoc(doc).then(function() {
	console.log('document saved!');

	db.openDoc('helloCouch').then(function(doc) {
		console.log('retrieved document!');
		console.log(JSON.stringify(doc));
	});
});

Before executing this module, create a database in your CouchDB named helloCouch using futon.

This program creates a document in the CouchDB Database helloCouch. Next, it saves a document to the database with a key of helloCouch and a text property. Then, it retrieves the document from the database and prints the contents of the document to the console.

Promises

Methods on CouchClient and Database return promises. The promises are Promises/A compliant. You may be familiar with promises in jQuery as they have recently been added to make Ajax calls cleaner.

FAQs

Package last updated on 28 Dec 2011

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