I'm using nano db library (also try this with cloudant ant library) for node js
I have this sample code :
exports.insert = function (db_name, data, callback) {
var db_name=db_name; if(!db){ db = nano.use(db_name); } console.log(`try to make bulk copy to Couchdb`); db.bulk(data, function (err, body) {
if (!err) {
console.log(`data in db ${db_name} inserted successfully`);
return callback(null, body);
}
console.log(`err ouccre ${err}`);
return callback(err);
}); }
The "data" variable is an object that contain the 'docs' property and 'docs' contain array.
I'ts always do the bulk work and put the docs array into my cloudnat db , but
Often doesn't return any callback (err / success) to my node js process
and it stuck...
Any suggestion?