How to connect nodejs couchbase with username and password

connections
n1ql

#1

I installed couchbase server with username (admin) and passsword(password) on my laptop.
I am creating a simple project. I can’t query my couchbase db with username and password and can’t query also.

    let cluster = new couchbase.Cluster("couchbase://127.0.0.1");
    let nquery = couchbase.N1qlQuery;

   cluster.authenticate({username:"admin", password: "password"});
   let myBucket = cluster.openBucket("notes");
   myBucket.query(query, function(err, result) {});

Can you please help me to connect


#2

Hey @gopimr2,

Try using this to authenticate instead:

cluster.authenticate('admin', 'password');

Cheers, Brett