couch_read.js
#! /usr/bin/node
// ---------------------------------------------------------------
// couch_read.js
//
// Jul/27/2020
// ---------------------------------------------------------------
var Client = require('node-rest-client').Client
// ---------------------------------------------------------------
console.error("*** 開始 ***")
var client = new Client()
const url = "http://localhost:5984/nagano/_all_docs?include_docs=true"
client.get(url, function(data, response) {
data.rows.forEach (function(row)
{
var out_str = row.id + "\t"
out_str += row.doc.name + "\t"
out_str += row.doc.population + "\t"
out_str += row.doc.date_mod;
console.log (out_str)
})
console.error("*** 終了 ***")
})
// ---------------------------------------------------------------
実行
export NODE_PATH=/usr/lib/node_modules
./couch_read.js