Reputation: 21
I am trying to save data point in Couchbase Using cradle with NodeJs. Checkout this code :
var cradle = require('cradle'),db;
var connection = new(cradle.Connection)('localhost', 8091, {
auth: { username: 'Admin', password: 'Admin' }
});
var db = connection.database('data');
db.save('exercise', {
name: 'satyam',
age: '24'
}, function (err, res) {
if (err) {
// Handle error
console.log("SAVE ERROR: Could not save record!!");
} else {
// Handle success
console.log("SUCESSFUL SAVE: The record was saved in CouchDB!");
}
console.log(res, new Date());
});
While executing this code I am getting msg : SUCESSFUL SAVE: The record was saved in CouchDB! {} Mon Mar 10 2014 17:57:09 GMT+0530 (IST)
Which seems like res is not having data. Can anybody help me out from this problem.
Upvotes: 0
Views: 318
Reputation: 869
You are using a wrong client. Cradle is a CouchDB client, whereas CouchBase is a different database. They have common root, so you are getting something that looks like it's almost working, but overall you are simply using a wrong tool.
Try using this instead: https://github.com/couchbase/couchnode
Upvotes: 1