Class: Cluster

Cluster

new Cluster(cnstr, options)

Represents a singular cluster containing your buckets.

Parameters:
Name Type Argument Description
cnstr string <optional>

The connection string for your cluster.

options Object <optional>
Properties
Name Type Argument Description
certpath string <optional>

The path to the certificate to use for SSL connections

Since:
  • 2.0.0 (stability: committed)

Methods

authenticate(auther)

Specifies an authenticator to use to authenticate to this cluster.

Parameters:
Name Type Description
auther Authenticator | Object
Since:
  • 2.1.7 (stability: uncommitted)

manager() → {ClusterManager}

Creates a manager allowing the management of a Couchbase cluster.

Since:
  • 2.0.0 (stability: committed)
Returns:
Type
ClusterManager

openBucket(name, password, callback) → {Bucket}

Open a bucket to perform operations. This will begin the handshake process immediately and operations will complete later. Subscribe to the connect event to be alerted when the connection is ready, though be aware operations can be successfully queued before this.

Parameters:
Name Type Argument Description
name string <optional>

The name of the bucket to open.

password string <optional>

Password for the bucket.

callback function <optional>

Callback to invoke on connection success or failure.

Since:
  • 2.0.0 (stability: committed)
Returns:
Type
Bucket

query(query, params, callback) → {Bucket.N1qlQueryResponse|Bucket.FtsQueryResponse|Cluster.CbasQueryResponse}

Executes a previously prepared query object. This could be a N1qlQuery, SearchQuery or a CbasQuery.

Note: You must have at least one bucket open (this is neccessary to have cluster mapping information), and additionally be using the new cluster-level authentication methods.

Note: SearchQuery queries are currently an uncommitted interface and may be subject to change in a future release.

Parameters:
Name Type Argument Description
query N1qlQuery | SearchQuery | CbasQuery

The query to execute.

params Object | Array <optional>

A list or map to do replacements on a N1QL or CBAS query.

callback Bucket.QueryCallback
Since:
  • 2.1.7 (stability: committed)
Returns:
Type
Bucket.N1qlQueryResponse | Bucket.FtsQueryResponse | Cluster.CbasQueryResponse