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

cloudant-upsert

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cloudant-upsert

Adds an upsert function to the [nodejs-cloudant](https://github.com/cloudant/nodejs-cloudant/blob/master/cloudant.js) library. This library does not include any package dependencies.

  • 0.11.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
148
increased by17.46%
Maintainers
1
Weekly downloads
 
Created
Source

cloudant-upsert

Adds an upsert function to the nodejs-cloudant library. This library does not include any package dependencies.

Install

npm install cloudant-upsert

Usage

var Cloudant = require('cloudant');
var cloudant = Cloudant('<YOUR_CLOUDANT_URI>');
require('cloudant-upsert')(cloudant);

Examples

Promises
var Cloudant = require('cloudant');
var cloudant = Cloudant({ url: '<YOUR_CLOUDANT_URL>', plugin: 'promises' });
require('cloudant-upsert')(cloudant);

cloudant.db.use('rooms').upsert('carmine', doc => ({
    "_id": "carmine",
    "_rev": doc._rev,
    "text": "Woop Woop! We're using promises",
  }))
  .then(r => console.log('result', r))
  .catch(e => console.log('error', e));
Callbacks
var Cloudant = require('cloudant');
var cloudant = Cloudant('<YOUR_CLOUDANT_URL>');
require('cloudant-upsert')(cloudant);

cloudant.db.use('mydb').upsert('carmine', doc => ({
    "_id": "carmine",
    "_rev": doc._rev,
    "text": "Woop! Woop! We're using callbacks"
  }), (err, data) => {
    if (err) console.log('error', err.reason)
    else console.log('data', data)
  })

License

MIT

Keywords

FAQs

Package last updated on 24 Sep 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