node.js - Deleting a document from Cloudant Database in nodejs -


this may basic question i've looked through github cloudant library , cloudant documentation , deleting specific document database mentioned never thoroughly explained. it's frustrating. closest i've gotten deleting document using http request rather functions cloudant library offers , continuously "document update conflict" though i'm passing through _rev of document. can explain deleting document cloudant database using nodejs example sort out. thanks.

it depends node module using communicating cloudant. nano driver, can use destroy method delete document. see following code example:

var nano = require("nano")("cloudanturl"),   db = nano.db.use("yourdb"); db.destroy(docuniqueid, docrevnum, function(err, body, header) {   if (!err) {     console.log("successfully deleted doc", docuniqueid);   } }); 

key

  • cloudanturl - url of cloudant instance, username , password embedded
  • yourdb - database name
  • docuniqueid - unique id of doc want delete
  • docrevnum - revision number of doc want delete

Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

c# - two queries in same method -