var http = require(“http”);
var server = http.createServer(insertData);
var driver = require(‘couchbase’);
var cb = new driver.Cluster(“localhost:8091”,“default”);
var baseview = require(‘baseview’)({url: ‘http://127.0.0.1:8091’, bucket:‘default’});
console.log (“bachka si”);
function insertData() {
var emps = [{
“type”: “employee”,
“id”: 100,
“name”: “Anton”,
“dept”: “Sales”,
“salary”: 5000
}, {
“type”: “employee”,
“id”: 200,
“name”: “Ivan”,
“dept”: “IT”,
“salary”: 3000
}, {
“type”: “employee”,
“id”: 300,
“name”: “Petko”,
“dept”: “Manager”,
“salary”: 10000
}] for (index = 0; index < emps.lenght; index++) { cb.add(JSON.stringify(emps[index].id), JSON.stringify(emps[index]), 0, undefined, function (data, err, key, cas) { if (err && err != 12) { console.log("FAIL!" + err); } }); }
Here i try to insert data into my Couchbase instance. Everything works fine says the console and there is no error there but when i open my Couchbase Admin Console there is no new Data. And i cant understand why ?