Is it possible to keep the connection of couchbase?


#1

I use the code below to query from couchbase

var KDatabase = function() {

};
KDatabase.prototype.query1 = function(userName) {
var couchbase = require(‘couchbase’);
var db = new couchbase.Connection({

        host: "http://127.0.0.1:8091",

        bucket: "default",

    },
    function(err) {

        if (err) {
            throw err;
            return s;
        }
        console.log(userName + '!!!!--');

        db.get(userName, function(err, result) {


            if (err) throw err;
            var o = result.value;
            console.log(o['password'] + '***--');///AAA
            return o['password'];
        });

    });

}

var a = new KDatabase();
a.query1(“id1”, function(err, result) {
console.log(a.query1(“id1”) + “000”); //BBB
});

until AAA, everything is ok

but BBB never be triggered

your comment welcome