A class representing a connection to a Couchbase cluster.
Normally, your application should only need to create one of these per
bucket and use it continuously. Operations are executed asynchronously
and pipelined when possible.
desc
Instantiate a new Connection object. Note that it is safe to perform
operations before the connect callback is invoked. In this case, the
operations are queued until the connection is ready (or an unrecoverable
error has taken place).
param
A dictionary of options to use. You may pass
other options than those defined below which correspond to the various
options available on the Connection object (see their documentation).
For example, it may be helpful to set timeout properties before connecting.
@param {string|string[]} [options.host="localhost:8091"]
A string or array of strings indicating the hosts to connect to. If the
value is an array, all the hosts in the array will be tried until one of
them succeeds.
@param {string} [options.bucket="default"]
The bucket to connect to. If not specified, the default is
'default'.
@param {string} [options.password=""]
The password for a password protected bucket.
param
A callback that will be invoked when the instance has completed connecting
to the server. Note that this isn't required - however if the connection
fails, an exception will be thrown if the callback is not provided.
example
var couchbase = require('couchbase');
var db = new couchbase.Connection({}, function(err) {
if (err) {
console.log('Connection Error', err);
} else {
console.log('Connected!');
}
});