1

How can a JSON document be saved on couchdb using "db" package in kanso through your javascript code? This is what I've tried but it doesn't work:

var db=require('db').use('it');
db.saveDoc(doc, function(err,response) {
    if(err) {
        alert('Error');
    } else {
        alert('Data Added successfully');
    }
});
Entreco
  • 12,738
  • 8
  • 75
  • 95
  • Do you get an error in the console? You can check if you can access the db from the browser. Try to run this: var db = require('db').use('it'); db.info(function(err, res){ console.log(res); }) You should get an object resembling this: {db_name: "it", doc_count: 5, doc_del_count: 20, update_seq: 1124, purge_seq: 0…} – da_deef Mar 28 '13 at 10:35
  • Please add information to your question: which errors do you get back? Is the doc you are passing in correct json format? Which is the output? – Daniele B May 03 '13 at 18:36

0 Answers0