LoginSignup
0
0

More than 3 years have passed since last update.

Node.js: CouchDB のデータを削除 (Delete)

Posted at
couch_delete.js
#! /usr/bin/node
// ---------------------------------------------------------------
//  couch_delete.js
//
//                  Jul/27/2020
// ---------------------------------------------------------------
var Client = require('node-rest-client').Client
// ---------------------------------------------------------------
console.error("*** 開始 ***")

const key_in=process.argv[2]

console.log (key_in)

const url = "http://localhost:5984/nagano/" + key_in

var client = new Client()
client.get(url, function(data, response) {
    console.log (data)
    console.log (data._rev)

    const url_del = url + '?rev=' + data._rev
    client.delete(url_del, function(data, response) {
        console.log (data)
        console.error("*** 終了 ***")
        })
    })

// ---------------------------------------------------------------

実行

export NODE_PATH=/usr/lib/node_modules
./couch_delete.js t2029
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0