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

loopback-connector-couchdb

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

loopback-connector-couchdb

LoopBack CouchDB Connector

  • 0.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
10
decreased by-28.57%
Maintainers
1
Weekly downloads
 
Created
Source

loopback-connector-couchdb

Build Status Coverage Status

What

A connector is used to connect Loopback models to a storage, and in this case, a CouchDB DB. See the official doc for Connecting models to data sources.

How to

Config

Example:

// server/datasources.json
{
  "lorem": {
    "name": "cache", // the datasource name
    "connector": "couchdb", // the connector name
    "url": "${couchdbUrl}", // optional
    "database": "lorem", // required
    "designDocs": {} // optional
  }
}

Install design docs

The designDocs that you put in the datasource config can be installed with autoupdate() or automigrate(). Example:

// server/datasources.json
{
  "lorem": {
    ...
    "designDocs": {
      "find": {
        "views": {
          "byName": {
            "map": "function(doc) { if (doc.name) emit(doc.name, null); }"
          }
        }
      }
    }
  }
}

Use a view

Example:

// Assuming you have a connector instance.
// Note that `connect()` returns a cached connection (singleton, promisified, wrapped in a Bluebird promise).
connector.connect().call('viewAsync', 'find', 'byName', { keys: ['Charlie'] }).then((res) => {
  res.should.be.Object();
  res.should.have.property('rows').which.is.Array().with.length(1);
});

See the tests for more examples.

Keywords

FAQs

Package last updated on 23 Feb 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