couchbase
- Version 4.4.4
- Published
- 36.4 MB
- 2 dependencies
- Apache-2.0 license
Install
npm i couchbase
yarn add couchbase
pnpm add couchbase
Overview
The official Couchbase Node.js Client Library.
Index
Variables
Functions
Classes
EventingFunctionSettings
- appLogDir
- appLogMaxFiles
- appLogMaxSize
- bucketCacheAge
- bucketCacheSize
- checkpointInterval
- cppWorkerThreadCount
- curlMaxAllowedRespSize
- dcpStreamBoundary
- deploymentStatus
- description
- enableAppLogRotation
- executionTimeout
- handlerFooters
- handlerHeaders
- languageCompatibility
- lcbInstCapacity
- lcbRetryCount
- lcbTimeout
- logLevel
- numTimerPartitions
- processingStatus
- queryConsistency
- queryPrepareAll
- sockBatchSize
- tickDuration
- timerContextSize
- userPrefix
- workerCount
Interfaces
Enums
Type Aliases
Variables
variable cbppMetadata
const cbppMetadata: string;
variable cbppVersion
const cbppVersion: string;
Exposes the underlying couchbase++ library version that is being used by the SDK to perform I/O with the cluster.
variable lcbVersion
const lcbVersion: string;
Exposes the underlying couchbase++ library version that is being used by the SDK to perform I/O with the cluster.
Deprecated
Use cbppVersion instead.
Functions
function connect
connect: ( connStr: string, options?: ConnectOptions, callback?: NodeCallback<Cluster>) => Promise<Cluster>;
Acts as the entrypoint into the rest of the library. Connecting to the cluster and exposing the various services and features.
Parameter connStr
The connection string to use to connect to the cluster.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution. Core
function enableProtocolLoggerToSaveNetworkTrafficToFile
enableProtocolLoggerToSaveNetworkTrafficToFile: (filename: string) => void;
Volatile: This API is subject to change at any time.
Exposes the underlying couchbase++ library protocol logger. This method is for logging/debugging purposes and must be used with caution as network details will be logged to the provided file.
Parameter filename
Name of file protocol logger will save logging details.
function shutdownLogger
shutdownLogger: () => void;
Volatile: This API is subject to change at any time.
Shutdowns the underlying couchbase++ logger.
Classes
class AmbiguousTimeoutError
class AmbiguousTimeoutError extends TimeoutError {}
Indicates that an ambiguous timeout has occured. The outcome of the operation is unknown, and it is possible that it completed after the generation of this error.
Error Handling
constructor
constructor(cause?: Error, context?: ErrorContext);
class AnalyticsDataset
class AnalyticsDataset {}
Contains a specific dataset configuration for the analytics service.
Management
property bucketName
bucketName: string;
The name of the bucket that this dataset includes.
property dataverseName
dataverseName: string;
The name of the dataverse that this dataset exists within.
property linkName
linkName: string;
The name of the link that is associated with this dataset.
property name
name: string;
The name of the dataset.
class AnalyticsErrorContext
class AnalyticsErrorContext extends ErrorContext {}
The error context information for an analytics query operation.
Error Handling
property client_context_id
client_context_id: string;
The client context id which was sent to the service for correlation between requests and responses.
property http_response_body
http_response_body: string;
The http response body which was received.
property http_response_code
http_response_code: number;
The http response status code which was received.
property parameters
parameters: any;
A list of the parameters in use for the operation.
property statement
statement: string;
The statement that was being executed when the error occured.
class AnalyticsIndex
class AnalyticsIndex {}
Contains a specific index configuration for the analytics service.
Management
property datasetName
datasetName: string;
The name of the dataset this index belongs to.
property dataverseName
dataverseName: string;
The name of the dataverse this index belongs to.
property isPrimary
isPrimary: boolean;
Whether or not this is a primary index or not.
property name
name: string;
The name of the index.
class AnalyticsIndexManager
class AnalyticsIndexManager {}
AnalyticsIndexManager provides an interface for performing management operations against the analytics service of the cluster.
Management
method connectLink
connectLink: { ( linkStr: string, options?: ConnectAnalyticsLinkOptions, callback?: NodeCallback<void> ): Promise<void>; ( options?: ConnectAnalyticsLinkOptions, callback?: NodeCallback<void> ): Promise<void>;};
Connects a not yet connected link.
Parameter linkStr
The name of the link to connect.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
Deprecated
Use the other overload instead.
Connects a not yet connected link.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method createDataset
createDataset: ( bucketName: string, datasetName: string, options?: CreateAnalyticsDatasetOptions, callback?: NodeCallback<void>) => Promise<void>;
Creates a new dataset.
Parameter bucketName
The name of the bucket to create this dataset of.
Parameter datasetName
The name of the new dataset.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method createDataverse
createDataverse: ( dataverseName: string, options?: CreateAnalyticsDataverseOptions, callback?: NodeCallback<void>) => Promise<void>;
Creates a new dataverse.
Parameter dataverseName
The name of the dataverse to create.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method createIndex
createIndex: ( datasetName: string, indexName: string, fields: { [key: string]: string }, options?: CreateAnalyticsIndexOptions, callback?: NodeCallback<void>) => Promise<void>;
Creates a new index.
Parameter datasetName
The name of the dataset to create this index on.
Parameter indexName
The name of index to create.
Parameter fields
A map of fields that the index should contain.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method createLink
createLink: ( link: IAnalyticsLink, options?: CreateAnalyticsLinkOptions, callback?: NodeCallback<void>) => Promise<void>;
Creates a new analytics remote link.
Parameter link
The settings for the link to create.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method disconnectLink
disconnectLink: { ( linkStr: string, options?: DisconnectAnalyticsLinkOptions, callback?: NodeCallback<void> ): Promise<void>; ( options?: DisconnectAnalyticsLinkOptions, callback?: NodeCallback<void> ): Promise<void>;};
Disconnects a previously connected link.
Parameter linkStr
The name of the link to disconnect.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
Deprecated
Use the other overload instead.
Disconnects a previously connected link.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method dropDataset
dropDataset: ( datasetName: string, options?: DropAnalyticsDatasetOptions, callback?: NodeCallback<void>) => Promise<void>;
Drops a previously created dataset.
Parameter datasetName
The name of the dataset to drop.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method dropDataverse
dropDataverse: ( dataverseName: string, options?: DropAnalyticsDataverseOptions, callback?: NodeCallback<void>) => Promise<void>;
Drops a previously created dataverse.
Parameter dataverseName
The name of the dataverse to drop.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method dropIndex
dropIndex: ( datasetName: string, indexName: string, options?: DropAnalyticsIndexOptions, callback?: NodeCallback<void>) => Promise<void>;
Drops a previously created index.
Parameter datasetName
The name of the dataset containing the index to drop.
Parameter indexName
The name of the index to drop.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method dropLink
dropLink: ( linkName: string, dataverseName: string, options?: DropAnalyticsLinkOptions, callback?: NodeCallback<void>) => Promise<void>;
Drops an existing analytics remote link.
Parameter linkName
The name of the link to drop.
Parameter dataverseName
The dataverse containing the link to drop.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method getAllDatasets
getAllDatasets: ( options?: GetAllAnalyticsDatasetsOptions, callback?: NodeCallback<AnalyticsDataset[]>) => Promise<AnalyticsDataset[]>;
Returns a list of all existing datasets.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method getAllIndexes
getAllIndexes: ( options?: GetAllAnalyticsIndexesOptions, callback?: NodeCallback<AnalyticsIndex[]>) => Promise<AnalyticsIndex[]>;
Returns a list of all existing indexes.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method getAllLinks
getAllLinks: ( options?: GetAllAnalyticsLinksOptions, callback?: NodeCallback<AnalyticsLink[]>) => Promise<AnalyticsLink[]>;
Returns a list of existing analytics remote links.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method getPendingMutations
getPendingMutations: ( options?: GetPendingAnalyticsMutationsOptions, callback?: NodeCallback<{ [k: string]: { [k: string]: number } }>) => Promise<{ [k: string]: { [k: string]: number } }>;
Returns a list of all pending mutations.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method replaceLink
replaceLink: ( link: IAnalyticsLink, options?: ReplaceAnalyticsLinkOptions, callback?: NodeCallback<void>) => Promise<void>;
Replaces an existing analytics remote link.
Parameter link
The settings for the updated link.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
class AnalyticsLink
abstract class AnalyticsLink implements IAnalyticsLink {}
This is a base class for specific link configurations for the analytics service.
class AnalyticsMetaData
class AnalyticsMetaData {}
Contains the meta-data that is returend from an analytics query.
Analytics
property clientContextId
clientContextId: string;
The client context id which is assoicated with the executed query.
property metrics
metrics: AnalyticsMetrics;
Various metrics which are made available by the query engine.
property requestId
requestId: string;
The request ID which is associated with the executed query.
property signature
signature?: any;
Provides the signature of the query.
property status
status: AnalyticsStatus;
The status of the query at the time the query meta-data was generated.
property warnings
warnings: AnalyticsWarning[];
Any warnings that occurred during the execution of the query.
class AnalyticsMetrics
class AnalyticsMetrics {}
Contains various metrics that are returned by the server following the execution of an analytics query.
Analytics
property elapsedTime
elapsedTime: number;
The total amount of time spent running the query, in milliseconds.
property errorCount
errorCount: number;
The total number of errors which were encountered during the execution of the query.
property executionTime
executionTime: number;
The total amount of time spent executing the query, in milliseconds.
property processedObjects
processedObjects: number;
The total number of objects that were processed as part of execution of the query.
property resultCount
resultCount: number;
The total number of rows which were part of the result set.
property resultSize
resultSize: number;
The total number of bytes which were generated as part of the result set.
property warningCount
warningCount: number;
The total number of warnings which were encountered during the execution of the query.
class AnalyticsResult
class AnalyticsResult<TRow = any> {}
Contains the results of an analytics query.
Analytics
class AnalyticsWarning
class AnalyticsWarning {}
Contains information about a warning which occurred during the execution of an analytics query.
Analytics
class AuthenticationFailureError
class AuthenticationFailureError extends CouchbaseError {}
Indicates that an error occurred authenticating the user to the cluster.
Error Handling
constructor
constructor(cause?: Error, context?: ErrorContext);
class AzureExternalAnalyticsLink
class AzureExternalAnalyticsLink extends AnalyticsLink implements IAzureExternalAnalyticsLink {}
Provides information about a analytics remote S3 link.
property accountKey
accountKey?: string;
The Azure blob storage account key.
property accountName
accountName?: string;
The Azure blob storage account name.
property blobEndpoint
blobEndpoint?: string;
The Azure blob storage endpoint.
property connectionString
connectionString?: string;
The connection string to use to connect to the external Azure store.
property dataverse
dataverse: string;
The dataverse that this link belongs to.
property endpointSuffix
endpointSuffix?: string;
The Azure blob endpoint suffix.
property linkType
linkType: string;
Specifies what type of analytics link this represents.
property name
name: string;
The name of this link.
property sharedAccessSignature
sharedAccessSignature?: string;
The shared access signature to use for authentication.
method validate
validate: () => void;
Validates the AzureExternalAnalyticsLink.
class BinaryCollection
class BinaryCollection {}
Exposes a number of binary-level operations against a collection. These operations do not adhere to the standard JSON-centric behaviour of the SDK.
Core
method append
append: ( key: string, value: string | Buffer, options?: AppendOptions, callback?: NodeCallback<MutationResult>) => Promise<MutationResult>;
Appends the specified value to the end of the specified key.
Parameter key
The key to append to.
Parameter value
The value to adjoin to the end of the document.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method decrement
decrement: ( key: string, delta: number, options?: DecrementOptions, callback?: NodeCallback<CounterResult>) => Promise<CounterResult>;
Decrements the ASCII value of the specified key by the amount indicated in the delta parameter.
Parameter key
The key to increment.
Parameter delta
The amount to increment the key.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method increment
increment: ( key: string, delta: number, options?: IncrementOptions, callback?: NodeCallback<CounterResult>) => Promise<CounterResult>;
Increments the ASCII value of the specified key by the amount indicated in the delta parameter.
Parameter key
The key to increment.
Parameter delta
The amount to increment the key.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method prepend
prepend: ( key: string, value: string | Buffer, options?: PrependOptions, callback?: NodeCallback<MutationResult>) => Promise<MutationResult>;
Prepends the specified value to the beginning of the specified key.
Parameter key
The key to prepend to.
Parameter value
The value to adjoin to the beginning of the document.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
class BooleanFieldSearchQuery
class BooleanFieldSearchQuery extends SearchQuery {}
Represents a boolean-field search query.
Full Text Search
class BooleanSearchQuery
class BooleanSearchQuery extends SearchQuery {}
Represents a boolean search query.
Full Text Search
method boost
boost: (boost: number) => BooleanSearchQuery;
method must
must: (query: ConjunctionSearchQuery) => BooleanSearchQuery;
method mustNot
mustNot: (query: DisjunctionSearchQuery) => BooleanSearchQuery;
method should
should: (query: DisjunctionSearchQuery) => BooleanSearchQuery;
method shouldMin
shouldMin: (shouldMin: number) => BooleanSearchQuery;
method toJSON
toJSON: () => any;
class Bucket
class Bucket {}
Exposes the operations which are available to be performed against a bucket. Namely the ability to access to Collections as well as performing management operations against the bucket.
Core
property name
readonly name: string;
The name of the bucket this Bucket object references.
method collection
collection: (collectionName: string) => Collection;
Creates a Collection object reference to a specific collection.
Parameter collectionName
The name of the collection to reference.
method collections
collections: () => CollectionManager;
Returns a CollectionManager which can be used to manage the collections of this bucket.
method defaultCollection
defaultCollection: () => Collection;
Creates a Collection object reference to the default collection.
method defaultScope
defaultScope: () => Scope;
Creates a Scope object reference to the default scope.
method ping
ping: ( options?: PingOptions, callback?: NodeCallback<PingResult>) => Promise<PingResult>;
Performs a ping operation against the cluster. Pinging the bucket services which are specified (or all services if none are specified). Returns a report which describes the outcome of the ping operations which were performed.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method scope
scope: (scopeName: string) => Scope;
Creates a Scope object reference to a specific scope.
Parameter scopeName
The name of the scope to reference.
method viewIndexes
viewIndexes: () => ViewIndexManager;
Returns a ViewIndexManager which can be used to manage the view indexes of this bucket.
method viewQuery
viewQuery: <TValue = any, TKey = any>( designDoc: string, viewName: string, options?: ViewQueryOptions, callback?: NodeCallback<ViewResult<TValue, TKey>>) => StreamableRowPromise< ViewResult<TValue, TKey>, ViewRow<TValue, TKey>, ViewMetaData>;
Executes a view query.
Parameter designDoc
The name of the design document containing the view to execute.
Parameter viewName
The name of the view to execute.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
class BucketExistsError
class BucketExistsError extends CouchbaseError {}
Indicates that the referenced bucket already exists, but the operation expected it to not exist.
Error Handling
constructor
constructor(cause?: Error, context?: ErrorContext);
class BucketManager
class BucketManager {}
BucketManager provides an interface for adding/removing/updating buckets within the cluster.
Management
method createBucket
createBucket: ( settings: ICreateBucketSettings, options?: CreateBucketOptions, callback?: NodeCallback<void>) => Promise<void>;
Creates a new bucket.
Parameter settings
The settings to use for the new bucket.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method dropBucket
dropBucket: ( bucketName: string, options?: DropBucketOptions, callback?: NodeCallback<void>) => Promise<void>;
Drops an existing bucket.
Parameter bucketName
The name of the bucket to drop.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method flushBucket
flushBucket: ( bucketName: string, options?: FlushBucketOptions, callback?: NodeCallback<void>) => Promise<void>;
Flushes the bucket, deleting all the existing data that is stored in it.
Parameter bucketName
The name of the bucket to flush.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method getAllBuckets
getAllBuckets: ( options?: GetAllBucketsOptions, callback?: NodeCallback<BucketSettings[]>) => Promise<BucketSettings[]>;
Returns a list of existing buckets in the cluster.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method getBucket
getBucket: ( bucketName: string, options?: GetBucketOptions, callback?: NodeCallback<BucketSettings>) => Promise<BucketSettings>;
Fetches the settings in use for a specified bucket.
Parameter bucketName
The name of the bucket to fetch settings for.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method updateBucket
updateBucket: ( settings: BucketSettings, options?: UpdateBucketOptions, callback?: NodeCallback<void>) => Promise<void>;
Updates the settings for an existing bucket.
Parameter settings
The new settings to use for the bucket.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
class BucketNotFlushableError
class BucketNotFlushableError extends CouchbaseError {}
Indicates that the bucket could not be flushed due to not having the flush option enabled. This option can be dynamically adjusted.
Error Handling
constructor
constructor(cause?: Error, context?: ErrorContext);
class BucketNotFoundError
class BucketNotFoundError extends CouchbaseError {}
Indicates that the bucket being referenced does not exist.
Error Handling
constructor
constructor(cause?: Error, context?: ErrorContext);
class BucketSettings
class BucketSettings implements IBucketSettings {}
Represents the configured options for a bucket.
Management
property bucketType
bucketType?: BucketType;
Specifies the type of bucket that should be used.
property compressionMode
compressionMode?: CompressionMode;
Specifies the compression mode that should be used.
property durabilityMinLevel
readonly durabilityMinLevel: string;
Same as IBucketSettings.minimumDurabilityLevel, but represented as the raw server-side configuration string.
Deprecated
Use IBucketSettings.minimumDurabilityLevel instead.
property ejectionMethod
ejectionMethod: string;
Same as IBucketSettings.evictionPolicy.
Deprecated
Use IBucketSettings.evictionPolicy instead.
property evictionPolicy
evictionPolicy?: EvictionPolicy;
Specifies the ejection method that should be used.
property flushEnabled
flushEnabled?: boolean;
Whether the flush operation (truncating all data in the bucket) should be enabled.
property historyRetentionBytes
historyRetentionBytes?: number;
Specifies the maximum history retention in bytes on all collections in this bucket.
property historyRetentionCollectionDefault
historyRetentionCollectionDefault?: boolean;
Specifies the default history retention on all collections in this bucket. Only available on Magma Buckets.
See Also
property historyRetentionDuration
historyRetentionDuration?: number;
Specifies the maximum duration in seconds to be covered by the change history that is written to disk for all collections in this bucket.
property maxExpiry
maxExpiry?: number;
Specifies the maximum expiry time that any document should be permitted to have. Any documents stored with an expiry configured higher than this will be forced to this number.
property maxTTL
maxTTL: number;
Same as IBucketSettings.maxExpiry.
Deprecated
Use IBucketSettings.maxExpiry instead.
property minimumDurabilityLevel
minimumDurabilityLevel?: DurabilityLevel;
Specifies the minimum durability level that should be used for any write operations which are performed against this bucket.
property name
name: string;
The name of the bucket.
property numReplicas
numReplicas?: number;
The number of replicas that should exist for this bucket.
property ramQuotaMB
ramQuotaMB: number;
The amount of RAM which should be allocated to this bucket, expressed in megabytes.
property replicaIndexes
replicaIndexes?: boolean;
Whether the indexes on this bucket should be replicated.
property storageBackend
storageBackend?: string;
Specifies the storage backend to use for the bucket.
class CasMismatchError
class CasMismatchError extends CouchbaseError {}
Indicates that a CAS mismatch occurred. This means that the document has changed since the last access and should be fetched again before attempting to make further changes.
Error Handling
constructor
constructor(cause?: Error, context?: ErrorContext);
class CertificateAuthenticator
class CertificateAuthenticator implements ICertificateAuthenticator {}
CertificateAuthenticator implements a simple ICertificateAuthenticator.
Authentication
constructor
constructor(certificatePath: string, keyPath: string);
Constructs this CertificateAuthenticator with the passed certificate and key paths.
Parameter certificatePath
The certificate path to initialize this authenticator with.
Parameter keyPath
The key path to initialize this authenticator with.
property certificatePath
certificatePath: string;
The path to the certificate which should be used for certificate authentication.
property keyPath
keyPath: string;
The path to the key which should be used for certificate authentication.
class Cluster
class Cluster {}
Exposes the operations which are available to be performed against a cluster. Namely the ability to access to Buckets as well as performing management operations against the cluster.
Core
method analyticsIndexes
analyticsIndexes: () => AnalyticsIndexManager;
Returns a AnalyticsIndexManager which can be used to manage the analytics indexes of this cluster.
method analyticsQuery
analyticsQuery: <TRow = any>( statement: string, options?: AnalyticsQueryOptions, callback?: NodeCallback<AnalyticsResult<TRow>>) => StreamableRowPromise<AnalyticsResult<TRow>, TRow, AnalyticsMetaData>;
Executes an analytics query against the cluster.
Parameter statement
The analytics statement to execute.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method bucket
bucket: (bucketName: string) => Bucket;
Creates a Bucket object reference to a specific bucket.
Parameter bucketName
The name of the bucket to reference.
method buckets
buckets: () => BucketManager;
Returns a BucketManager which can be used to manage the buckets of this cluster.
method close
close: (callback?: NodeCallback<void>) => Promise<void>;
Shuts down this cluster object. Cleaning up all resources associated with it.
Parameter callback
A node-style callback to be invoked after execution.
method diagnostics
diagnostics: ( options?: DiagnosticsOptions, callback?: NodeCallback<DiagnosticsResult>) => Promise<DiagnosticsResult>;
Returns a diagnostics report about the currently active connections with the cluster. Includes information about remote and local addresses, last activity, and other diagnostics information.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method eventingFunctions
eventingFunctions: () => EventingFunctionManager;
Returns a EventingFunctionManager which can be used to manage the eventing functions of this cluster. Uncommitted: This API is subject to change in the future.
method ping
ping: ( options?: PingOptions, callback?: NodeCallback<PingResult>) => Promise<PingResult>;
Performs a ping operation against the cluster. Pinging the services which are specified (or all services if none are specified). Returns a report which describes the outcome of the ping operations which were performed.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method query
query: <TRow = any>( statement: string, options?: QueryOptions, callback?: NodeCallback<QueryResult<TRow>>) => StreamableRowPromise<QueryResult<TRow>, TRow, QueryMetaData>;
Executes a N1QL query against the cluster.
Parameter statement
The N1QL statement to execute.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method queryIndexes
queryIndexes: () => QueryIndexManager;
Returns a QueryIndexManager which can be used to manage the query indexes of this cluster.
method search
search: ( indexName: string, request: SearchRequest, options?: SearchQueryOptions, callback?: NodeCallback<SearchResult>) => StreamableRowPromise<SearchResult, SearchRow, SearchMetaData>;
Executes a search query against the cluster.
Parameter indexName
The name of the index to query.
Parameter request
The SearchRequest describing the search to execute.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method searchIndexes
searchIndexes: () => SearchIndexManager;
Returns a SearchIndexManager which can be used to manage the search indexes of this cluster.
method searchQuery
searchQuery: ( indexName: string, query: SearchQuery, options?: SearchQueryOptions, callback?: NodeCallback<SearchResult>) => StreamableRowPromise<SearchResult, SearchRow, SearchMetaData>;
Executes a search query against the cluster.
Parameter indexName
The name of the index to query.
Parameter query
The SearchQuery describing the query to execute.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method transactions
transactions: () => Transactions;
Returns a Transactions object which can be used to perform transactions on this cluster.
method users
users: () => UserManager;
Returns a UserManager which can be used to manage the users of this cluster.
class ClusterClosedError
class ClusterClosedError extends CouchbaseError {}
Indicates that an operation was performed after the cluster object was explicitly closed by the user.
Error Handling
constructor
constructor();
class Collection
class Collection {}
Exposes the operations which are available to be performed against a collection. Namely the ability to perform KV operations.
Core
property name
readonly name: string;
The name of the collection this Collection object references.
method binary
binary: () => BinaryCollection;
Returns a BinaryCollection object reference, allowing access to various binary operations possible against a collection.
method exists
exists: ( key: string, options?: ExistsOptions, callback?: NodeCallback<ExistsResult>) => Promise<ExistsResult>;
Checks whether a specific document exists or not.
Parameter key
The document key to check for existence.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method get
get: ( key: string, options?: GetOptions, callback?: NodeCallback<GetResult>) => Promise<GetResult>;
Retrieves the value of a document from the collection.
Parameter key
The document key to retrieve.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method getAllReplicas
getAllReplicas: ( key: string, options?: GetAllReplicasOptions, callback?: NodeCallback<GetReplicaResult[]>) => Promise<GetReplicaResult[]>;
Retrieves the value of the document from all available replicas. Note that as replication is asynchronous, each node may return a different value.
Parameter key
The document key to retrieve.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method getAndLock
getAndLock: ( key: string, lockTime: number, options?: GetAndLockOptions, callback?: NodeCallback<GetResult>) => Promise<GetResult>;
Locks a document and retrieves the value of that document at the time it is locked.
Parameter key
The document key to retrieve and lock.
Parameter lockTime
The amount of time to lock the document for, specified in seconds.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method getAndTouch
getAndTouch: ( key: string, expiry: number, options?: GetAndTouchOptions, callback?: NodeCallback<GetResult>) => Promise<GetResult>;
Retrieves the value of the document and simultanously updates the expiry time for the same document.
Parameter key
The document to fetch and touch.
Parameter expiry
The new expiry to apply to the document, specified in seconds.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method getAnyReplica
getAnyReplica: ( key: string, options?: GetAnyReplicaOptions, callback?: NodeCallback<GetReplicaResult>) => Promise<GetReplicaResult>;
Retrieves the value of the document from any of the available replicas. This will return as soon as the first response is received from any replica node.
Parameter key
The document key to retrieve.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method insert
insert: ( key: string, value: any, options?: InsertOptions, callback?: NodeCallback<MutationResult>) => Promise<MutationResult>;
Inserts a new document to the collection, failing if the document already exists.
Parameter key
The document key to insert.
Parameter value
The value of the document to insert.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method list
list: (key: string) => CouchbaseList;
Returns a CouchbaseList permitting simple list storage in a document.
Parameter key
The document key the data-structure resides in.
method lookupIn
lookupIn: ( key: string, specs: LookupInSpec[], options?: LookupInOptions, callback?: NodeCallback<LookupInResult>) => Promise<LookupInResult>;
Performs a lookup-in operation against a document, fetching individual fields or information about specific fields inside the document value.
Parameter key
The document key to look in.
Parameter specs
A list of specs describing the data to fetch from the document.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method lookupInAllReplicas
lookupInAllReplicas: ( key: string, specs: LookupInSpec[], options?: LookupInOptions, callback?: NodeCallback<LookupInReplicaResult[]>) => Promise<LookupInReplicaResult[]>;
Performs a lookup-in operation against a document, fetching individual fields or information about specific fields inside the document value from all available replicas. Note that as replication is asynchronous, each node may return a different value.
Parameter key
The document key to look in.
Parameter specs
A list of specs describing the data to fetch from the document.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method lookupInAnyReplica
lookupInAnyReplica: ( key: string, specs: LookupInSpec[], options?: LookupInOptions, callback?: NodeCallback<LookupInReplicaResult>) => Promise<LookupInReplicaResult>;
Performs a lookup-in operation against a document, fetching individual fields or information about specific fields inside the document value from any of the available replicas in the cluster.
Parameter key
The document key to look in.
Parameter specs
A list of specs describing the data to fetch from the document.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method map
map: (key: string) => CouchbaseMap;
Returns a CouchbaseMap permitting simple map storage in a document.
Parameter key
The document key the data-structure resides in.
method mutateIn
mutateIn: ( key: string, specs: MutateInSpec[], options?: MutateInOptions, callback?: NodeCallback<MutateInResult>) => Promise<MutateInResult>;
Performs a mutate-in operation against a document. Allowing atomic modification of specific fields within a document. Also enables access to document extended-attributes.
Parameter key
The document key to mutate.
Parameter specs
A list of specs describing the operations to perform on the document.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method queryIndexes
queryIndexes: () => CollectionQueryIndexManager;
Returns a CollectionQueryIndexManager which can be used to manage the query indexes of this collection.
method queue
queue: (key: string) => CouchbaseQueue;
Returns a CouchbaseQueue permitting simple queue storage in a document.
Parameter key
The document key the data-structure resides in.
method remove
remove: ( key: string, options?: RemoveOptions, callback?: NodeCallback<MutationResult>) => Promise<MutationResult>;
Remove an existing document from the collection.
Parameter key
The document key to remove.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method replace
replace: ( key: string, value: any, options?: ReplaceOptions, callback?: NodeCallback<MutationResult>) => Promise<MutationResult>;
Replaces the value of an existing document. Failing if the document does not exist.
Parameter key
The document key to replace.
Parameter value
The new value for the document.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method scan
scan: ( scanType: RangeScan | SamplingScan | PrefixScan, options?: ScanOptions, callback?: NodeCallback<ScanResult[]>) => Promise<ScanResult[]>;
Performs a key-value scan operation.
Use this API for low concurrency batch queries where latency is not a critical as the system may have to scan a lot of documents to find the matching documents. For low latency range queries, it is recommended that you use SQL++ with the necessary indexes.
Parameter scanType
The type of scan to execute.
Parameter options
Optional parameters for the scan operation.
Parameter callback
A node-style callback to be invoked after execution.
method set
set: (key: string) => CouchbaseSet;
Returns a CouchbaseSet permitting simple set storage in a document.
Parameter key
The document key the data-structure resides in.
method touch
touch: ( key: string, expiry: number, options?: TouchOptions, callback?: NodeCallback<MutationResult>) => Promise<MutationResult>;
Updates the expiry on an existing document.
Parameter key
The document key to touch.
Parameter expiry
The new expiry to set for the document, specified in seconds.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method unlock
unlock: ( key: string, cas: CasInput, options?: UnlockOptions, callback?: NodeCallback<void>) => Promise<void>;
Unlocks a previously locked document.
Parameter key
The document key to unlock.
Parameter cas
The CAS of the document, used to validate lock ownership.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method upsert
upsert: ( key: string, value: any, options?: UpsertOptions, callback?: NodeCallback<MutationResult>) => Promise<MutationResult>;
Upserts a document to the collection. This operation succeeds whether or not the document already exists.
Parameter key
The document key to upsert.
Parameter value
The new value for the document.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
class CollectionExistsError
class CollectionExistsError extends CouchbaseError {}
Indicates that the referenced collection already exists, but the operation expected that it did not.
Error Handling
constructor
constructor(cause?: Error, context?: ErrorContext);
class CollectionManager
class CollectionManager {}
CollectionManager allows the management of collections within a Bucket.
Management
method createCollection
createCollection: { ( collectionSpec: ICollectionSpec, options?: CreateCollectionOptions, callback?: NodeCallback<void> ): Promise<void>; ( collectionName: string, scopeName: string, options?: CreateCollectionOptions, callback?: NodeCallback<void> ): Promise<void>; ( collectionName: string, scopeName: string, settings?: CreateCollectionSettings, options?: CreateCollectionOptions, callback?: NodeCallback<void> ): Promise<void>;};
Creates a collection in a scope.
Parameter collectionSpec
Specifies the settings for the new collection.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
Deprecated
Use the other overload instead.
Creates a collection in a scope.
Creates a collection in a scope.
Parameter collectionName
The name of the collection.
Parameter scopeName
The name of the scope containing this collection.
Parameter settings
The settings to use on creating the collection.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method createScope
createScope: ( scopeName: string, options?: CreateScopeOptions, callback?: NodeCallback<void>) => Promise<void>;
Creates a new scope.
Parameter scopeName
The name of the new scope to create.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method dropCollection
dropCollection: ( collectionName: string, scopeName: string, options?: DropCollectionOptions, callback?: NodeCallback<void>) => Promise<void>;
Drops a collection from a scope.
Parameter collectionName
The name of the collection to drop.
Parameter scopeName
The name of the scope containing the collection to drop.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method dropScope
dropScope: ( scopeName: string, options?: DropScopeOptions, callback?: NodeCallback<void>) => Promise<void>;
Drops a scope.
Parameter scopeName
The name of the scope to drop.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method getAllScopes
getAllScopes: ( options?: GetAllScopesOptions, callback?: NodeCallback<ScopeSpec[]>) => Promise<ScopeSpec[]>;
Returns all configured scopes along with their collections.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method updateCollection
updateCollection: ( collectionName: string, scopeName: string, settings: UpdateCollectionSettings, options?: UpdateCollectionOptions, callback?: NodeCallback<void>) => Promise<void>;
Updates a collection in a scope.
Parameter collectionName
The name of the collection to update.
Parameter scopeName
The name of the scope containing the collection.
Parameter settings
The settings to update on the collection.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
class CollectionNotFoundError
class CollectionNotFoundError extends CouchbaseError {}
Indicates that the collection being referenced does not exist.
Error Handling
constructor
constructor(cause?: Error, context?: ErrorContext);
class CollectionQueryIndexManager
class CollectionQueryIndexManager {}
CollectionQueryIndexManager provides an interface for managing the query indexes on the collection.
Management
method buildDeferredIndexes
buildDeferredIndexes: ( options?: BuildQueryIndexOptions, callback?: NodeCallback<string[]>) => Promise<string[]>;
Starts building any indexes which were previously created with deferred=true.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method createIndex
createIndex: ( indexName: string, keys: string[], options?: CreateQueryIndexOptions, callback?: NodeCallback<void>) => Promise<void>;
Creates a new query index.
Parameter indexName
The name of the new index.
Parameter keys
The keys which this index should cover.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method createPrimaryIndex
createPrimaryIndex: ( options?: CreatePrimaryQueryIndexOptions, callback?: NodeCallback<void>) => Promise<void>;
Creates a new primary query index.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method dropIndex
dropIndex: ( indexName: string, options?: DropQueryIndexOptions, callback?: NodeCallback<void>) => Promise<void>;
Drops an existing query index.
Parameter indexName
The name of the index to drop.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method dropPrimaryIndex
dropPrimaryIndex: ( options?: DropPrimaryQueryIndexOptions, callback?: NodeCallback<void>) => Promise<void>;
Drops an existing primary index.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method getAllIndexes
getAllIndexes: ( options?: GetAllQueryIndexesOptions, callback?: NodeCallback<QueryIndex[]>) => Promise<QueryIndex[]>;
Returns a list of indexes for a specific bucket.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
method watchIndexes
watchIndexes: ( indexNames: string[], timeout: number, options?: WatchQueryIndexOptions, callback?: NodeCallback<void>) => Promise<void>;
Waits for a number of indexes to finish creation and be ready to use.
Parameter indexNames
The names of the indexes to watch.
Parameter timeout
The maximum time to wait for the index, expressed in milliseconds.
Parameter options
Optional parameters for this operation.
Parameter callback
A node-style callback to be invoked after execution.
class CollectionSpec
class CollectionSpec {}
Contains information about a collection.
Management
property history
history?: boolean;
The history retention override setting in this collection. Only supported on Magma Buckets.
See Also
property maxExpiry
maxExpiry: number;
The maximum expiry for documents in this collection.
See Also
property name
name: string;
The name of the collection.
property scopeName
scopeName: string;
The name of the scope this collection exists in.
class CompilationFailureError
class CompilationFailureError extends CouchbaseError {}
Indicates that an error occurred while compiling a query.
Error Handling
constructor
constructor(cause?: Error, context?: ErrorContext);
class ConjunctionSearchQuery
class ConjunctionSearchQuery extends SearchQuery {}
Represents a conjunction search query.
Full Text Search
method and
and: { (queries: SearchQuery[]): ConjunctionSearchQuery; (...queries: SearchQuery[]): ConjunctionSearchQuery;};
Adds additional queries to this conjunction query.
Deprecated
Use the multi-argument overload instead.
Adds additional queries to this conjunction query.
method boost
boost: (boost: number) => ConjunctionSearchQuery;
class ConnectionClosedError
class ConnectionClosedError extends CouchbaseError {}
Indicates that an operation was performed after a connection was closed.
Error Handling
constructor
constructor();
class CouchbaseAnalyticsEncryptionSettings
class CouchbaseAnalyticsEncryptionSettings implements ICouchbaseAnalyticsEncryptionSettings {}
Includes information about an analytics remote links encryption.
property certificate
certificate?: Buffer;
Provides a certificate to use for connecting when encryption level is set to full. Required when encryptionLevel is set to Full.
property clientCertificate
clientCertificate?: Buffer;
Provides a client certificate to use for connecting when encryption level is set to full. Cannot be set if a username/password are used.
property clientKey
clientKey?: Buffer;
Provides a client key to use for connecting when encryption level is set to full. Cannot be set if a username/password are used.
property encryptionLevel
encryptionLevel: AnalyticsEncryptionLevel;
Specifies what level of encryption should be used.
class CouchbaseError
class CouchbaseError extends Error {}
A generic base error that all errors inherit. Exposes the cause and context of the error to enable easier debugging.
Error Handling
constructor
constructor(message: string, cause?: Error, context?: ErrorContext);
property cause
cause: Error;
Specifies the underlying cause of this error, if one is available.
property context
context: | KeyValueErrorContext | ViewErrorContext | QueryErrorContext | SearchErrorContext | AnalyticsErrorContext | HttpErrorContext;
Specifies additional contextual information which is available for this error. Depending on the service that generated it.
class CouchbaseList
class CouchbaseList {}
CouchbaseList provides a simplified interface for storing lists within a Couchbase document.
See Also
Collection.list Datastructures
method [Symbol.asyncIterator]
[Symbol.asyncIterator]: () => AsyncIterator<any>;
Provides the ability to async-for loop this object.
method forEach
forEach: ( rowCallback: (value: any, index: number, array: CouchbaseList) => void, callback?: NodeCallback<void>) => Promise<void>;
Iterates each item in the list.
Parameter rowCallback
A callback invoked for each item in the list.
Parameter callback
A node-style callback to be invoked after execution.
method getAll
getAll: (callback?: NodeCallback<any[]>) => Promise<any[]>;
Returns the entire list of items in this list.
Parameter callback
A node-style callback to be invoked after execution.
method getAt
getAt: (index: number, callback?: NodeCallback<any>) => Promise<any>;
Retrieves the item at a specific index in the list.
Parameter index
The index to retrieve.
Parameter callback
A node-style callback to be invoked after execution.
method indexOf
indexOf: (value: any, callback?: NodeCallback<number>) => Promise<number>;
Returns the index of a specific value from the list.
Parameter value
The value to search for.
Parameter callback
A node-style callback to be invoked after execution.
method push
push: (value: any, callback?: NodeCallback<void>) => Promise<void>;
Adds a new item to the end of the list.
Parameter value
The value to add.
Parameter callback
A node-style callback to be invoked after execution.
method removeAt
removeAt: (index: number, callback?: NodeCallback<void>) => Promise<void>;
Removes an item at a specific index from the list.
Parameter index
The index to remove.
Parameter callback
A node-style callback to be invoked after execution.
method size
size: (callback?: NodeCallback<number>) => Promise<number>;
Returns the number of items in the list.
Parameter callback
A node-style callback to be invoked after execution.
method unshift
unshift: (value: any, callback?: NodeCallback<void>) => Promise<void>;
Adds a new item to the beginning of the list.
Parameter value
The value to add.
Parameter callback
A node-style callback to be invoked after execution.
class CouchbaseMap
class CouchbaseMap {}
CouchbaseMap provides a simplified interface for storing a map within a Couchbase document.
See Also
Collection.map Datastructures
method [Symbol.asyncIterator]
[Symbol.asyncIterator]: () => AsyncIterator<[any, string]>;
Provides the ability to async-for loop this object.
method exists
exists: (item: string, callback?: NodeCallback<boolean>) => Promise<boolean>;
Checks whether a specific key exists in the map.
Parameter item
The key in the map to search for.
Parameter callback
A node-style callback to be invoked after execution.
method forEach
forEach: ( rowCallback: (value: any, key: string, map: CouchbaseMap) => void, callback?: NodeCallback<void>) => Promise<void>;
Iterates through every item in the map.
Parameter rowCallback
A callback invoked for each item in the list.
Parameter callback
A node-style callback to be invoked after execution.
method get
get: (item: string, callback?: NodeCallback<any>) => Promise<any>;
Fetches a specific key from the map.
Parameter item
The key in the map to retrieve.
Parameter callback
A node-style callback to be invoked after execution.
method getAll
getAll: ( callback?: NodeCallback<{ [key: string]: any }>) => Promise<{ [key: string]: any }>;
Returns an object representing all items in the map.
Parameter callback
A node-style callback to be invoked after execution.
method keys
keys: (callback?: NodeCallback<string[]>) => Promise<string[]>;
Returns a list of all the keys which exist in the map.
Parameter callback
A node-style callback to be invoked after execution.
method remove
remove: (item: string, callback?: NodeCallback<void>) => Promise<void>;
Removes a specific key from the map.
Parameter item
The key in the map to remove.
Parameter callback
A node-style callback to be invoked after execution.
method set
set: (item: string, value: any, callback?: NodeCallback<void>) => Promise<void>;
Sets a specific to the specified value in the map.
Parameter item
The key in the map to set.
Parameter value
The new value to set.
Parameter callback
A node-style callback to be invoked after execution.
method size
size: (callback?: NodeCallback<number>) => Promise<number>;
Returns the number of items that exist in the map.
Parameter callback
A node-style callback to be invoked after execution.
method values
values: (callback?: NodeCallback<any[]>) => Promise<any[]>;
Returns a list of all the values which exist in the map.
Parameter callback
A node-style callback to be invoked after execution.
class CouchbaseQueue
class CouchbaseQueue {}
CouchbaseQueue provides a simplified interface for storing a queue within a Couchbase document.
See Also
Collection.queue Datastructures
method pop
pop: (callback?: NodeCallback<any>) => Promise<any>;
Removes an item from the front of the queue.
Parameter callback
A node-style callback to be invoked after execution.
method push
push: (value: any, callback?: NodeCallback<void>) => Promise<void>;
Adds a new item to the back of the queue.
Parameter value
The value to add.
Parameter callback
A node-style callback to be invoked after execution.
method size
size: (callback?: NodeCallback<number>) => Promise<number>;
Returns the number of items in the queue.
Parameter callback
A node-style callback to be invoked after execution.
class CouchbaseRemoteAnalyticsLink
class CouchbaseRemoteAnalyticsLink extends AnalyticsLink implements ICouchbaseRemoteAnalyticsLink {}
Provides information about a analytics remote Couchbase link.
property dataverse
dataverse: string;
The dataverse that this link belongs to.
property encryption
encryption?: CouchbaseAnalyticsEncryptionSettings;
The encryption settings to be used for the link.
property hostname
hostname: string;
The hostname of the target Couchbase cluster.
property linkType
linkType: string;
Specifies what type of analytics link this represents.
property name
name: string;
The name of this link.
property password
password?: string;
The password to use for authentication with the remote cluster. Optional if client-certificate authentication (@see ICouchbaseAnalyticsEncryptionSettings.clientCertificate) is being used.
property username
username?: string;
The username to use for authentication with the remote cluster. Optional if client-certificate authentication (@see ICouchbaseAnalyticsEncryptionSettings.clientCertificate) is being used.
method validate
validate: () => void;
Validates the CouchbaseRemoteAnalyticsLink.
class CouchbaseSet
class CouchbaseSet {}
CouchbaseSet provides a simplified interface for storing a set within a Couchbase document.
See Also
Collection.set Datastructures
method add
add: (item: any, callback?: NodeCallback<boolean>) => Promise<boolean>;
Adds a new item to the set. Returning whether the item already existed in the set or not.
Parameter item
The item to add.
Parameter callback
A node-style callback to be invoked after execution.
method contains
contains: (item: any, callback?: NodeCallback<boolean>) => Promise<boolean>;
Returns whether a specific value already exists in the set.
Parameter item
The value to search for.
Parameter callback
A node-style callback to be invoked after execution.
method remove
remove: (item: any, callback?: NodeCallback<void>) => Promise<void>;
Removes a specific value from the set.
Parameter item
The value to remove.
Parameter callback
A node-style callback to be invoked after execution.
method size
size: (callback?: NodeCallback<number>) => Promise<number>;
Returns the number of elements in this set.
Parameter callback
A node-style callback to be invoked after execution.
method values
values: (callback?: NodeCallback<any[]>) => Promise<any[]>;
Returns a list of all values in the set.
Parameter callback
A node-style callback to be invoked after execution.
class CounterResult
class CounterResult {}
Contains the results of a counter operation (binary increment/decrement).
Key-Value
class DatasetExistsError
class DatasetExistsError extends CouchbaseError {}
Indicates that the referenced dataset already exists, but the operation expected that it did not.
Error Handling
constructor
constructor(cause?: Error, context?: ErrorContext);
class DatasetNotFoundError
class DatasetNotFoundError extends CouchbaseError {}
Indicates that the referenced dataset does not exist.
Error Handling
constructor
constructor(cause?: Error, context?: ErrorContext);
class DataverseExistsError
class DataverseExistsError extends CouchbaseError {}
Indicates that the referenced dataverse already exists, but the operation expected that it did not.
Error Handling
constructor
constructor(cause?: Error, context?: ErrorContext);
class DataverseNotFoundError
class DataverseNotFoundError extends CouchbaseError {}
Indicates that the referenced dataverse does not exist.
Error Handling
constructor
constructor(cause?: Error, context?: ErrorContext);
class DateRangeSearchQuery
class DateRangeSearchQuery extends SearchQuery {}
Represents a date-range search query.
Full Text Search
method boost
boost: (boost: number) => DateRangeSearchQuery;
method dateTimeParser
dateTimeParser: (parser: string) => DateRangeSearchQuery;
method end
end: (end: Date | string, inclusive?: boolean) => DateRangeSearchQuery;
method field
field: (field: string) => DateRangeSearchQuery;
method start
start: (start: Date | string, inclusive?: boolean) => DateRangeSearchQuery;
class DateSearchFacet
class DateSearchFacet extends SearchFacet {}
Provides ability to request a date facet.
Full Text Search
method addRange
addRange: (name: string, start?: Date, end?: Date) => DateSearchFacet;
class DecodingFailureError
class DecodingFailureError extends CouchbaseError {}
Indicates that there was a failure during decoding.
Error Handling
constructor
constructor(cause?: Error, context?: ErrorContext);
class DefaultTranscoder
class DefaultTranscoder implements Transcoder {}
The default transcoder implements cross-sdk transcoding capabilities by taking advantage of the common flags specification to ensure compatibility. This transcoder is capable of encoding/decoding any value which is encodable to JSON, and additionally has special-case handling for Buffer objects.
Key-Value
method decode
decode: (bytes: Buffer, flags: number) => any;
Decodes a buffer and flags tuple back to the original type of the document.
Parameter bytes
The bytes that were previously encoded.
Parameter flags
The flags associated with the data.
method encode
encode: (value: any) => [Buffer, number];
Encodes the specified value, returning a buffer and flags that are stored to the server and later used for decoding.
Parameter value
The value to encode.
class DeltaInvalidError
class DeltaInvalidError extends CouchbaseError {}
Indicates that the delta specified is invalid.
Error Handling
constructor
constructor(cause?: Error, context?: ErrorContext);
class DesignDocument
class DesignDocument {}
Contains information about a design document.
Management
constructor
constructor(data: { name: string; views?: { [viewName: string]: DesignDocumentView }; namespace?: DesignDocumentNamespace; rev?: string;});
constructor
constructor(name: string, views: { [viewName: string]: DesignDocumentView });
Deprecated
property name
name: string;
The name of the design document.
property namespace
namespace: DesignDocumentNamespace;
The namespace for this design document.
property rev
rev: string;
The revision of the design document.
property View
static readonly View: any;
Same as DesignDocumentView.
Deprecated
Use DesignDocumentView directly.
property views
views: { [viewName: string]: DesignDocumentView };
A map of the views that exist in this design document.
class DesignDocumentNotFoundError
class DesignDocumentNotFoundError extends CouchbaseError {}
Indicates that the referenced design document does not exist.
Error Handling
constructor
constructor(cause?: Error, context?: ErrorContext);
class DesignDocumentView
class DesignDocumentView {}
Contains information about a view in a design document.
Management
constructor
constructor(data: { map?: string; reduce?: string });
constructor
constructor(map?: string, reduce?: string);
Deprecated
property map
map: string;
The mapping function to use for this view.
property reduce
reduce: string;
The reduction function to use for this view.
class DiagnosticsEndpoint
class DiagnosticsEndpoint {}
DiagnosticsEndpoint represents a single endpoint in a diagnostics result.
Diagnostics
property bucket
bucket?: string;
The name of the bucket this endpoint is connected to.
property details
details?: any;
Various additional details about the endpoint.
property id
id: string;
The unique identifier for this endpoint.
property lastActivity
lastActivity: number;
The time in milliseconds since the last activity.
property local
local: string;
The local address of this endpoint.
property remote
remote: string;
The remote address of this endpoint.
property state
state: EndpointState;
The current state of this endpoint.
property type
type: ServiceType;
The type of service this entry represents.
class DiagnosticsResult
class DiagnosticsResult {}
DiagnosticsResult represents the output of a operation result.
Diagnostics
property id
id: string;
The unique identifier for this report.
property sdk
sdk: string;
The name of the SDK which generated this report.
property services
services: { [serviceType: string]: DiagnosticsEndpoint[] };
A list of service endpoints and their diagnostic status.
property version
version: number;
The version number of this report.
method toJSON
toJSON: () => JsonDiagnosticsReport;
Returns a JSON formatted diagnostics report.
class DisjunctionSearchQuery
class DisjunctionSearchQuery extends SearchQuery {}
Represents a disjunction search query.
Full Text Search
method boost
boost: (boost: number) => DisjunctionSearchQuery;
method or
or: { (queries: SearchQuery[]): DisjunctionSearchQuery; (...queries: SearchQuery[]): DisjunctionSearchQuery;};
Adds additional queries to this disjunction query.
Deprecated
Use the multi-argument overload instead.
Adds additional queries to this disjunction query.
class DmlFailureError
class DmlFailureError extends CouchbaseError {}
Indicates that a generic DML error occurred with a query.
Error Handling
constructor
constructor(cause?: Error, context?: ErrorContext);
class DocIdSearchQuery
class DocIdSearchQuery extends SearchQuery {}
Represents a document-id search query.
Full Text Search
method addDocIds
addDocIds: { (ids: string[]): DocIdSearchQuery; (...ids: string[]): DocIdSearchQuery;};
Adds additional document-id's to this query.
Deprecated
Use the multi-argument overload instead.
Adds additional document-id's to this query.
method boost
boost: (boost: number) => DocIdSearchQuery;
method field
field: (field: string) => DocIdSearchQuery;
class DocumentExistsError
class DocumentExistsError extends CouchbaseError {}
Indicates that the referenced document exists already, but the operation was not expecting it to exist.
Error Handling
constructor
constructor(cause?: Error, context?: ErrorContext);
class DocumentId
class DocumentId {}
Represents the path to a document.
Transactions
constructor
constructor();
property bucket
bucket: string;
The name of the bucket containing the document.
property collection
collection: string;
The name of the collection containing the document.
property key
key: string;
The key of the docuemnt.
property scope
scope: string;
The name of the scope containing the document.
class DocumentLockedError
class DocumentLockedError extends CouchbaseError {}
Indicates that the referenced document could not be used as it is currently locked, likely by another actor in the system.
Error Handling
constructor
constructor(cause?: Error, context?: ErrorContext);
class DocumentNotFoundError
class DocumentNotFoundError extends CouchbaseError {}
Indicates that the referenced document does not exist.
Error Handling
constructor
constructor(cause?: Error, context?: ErrorContext);
class DocumentNotJsonError
class DocumentNotJsonError extends CouchbaseError {}
Indicates that an operation expecting JSON was performed against a document which is not JSON.
Error Handling
constructor
constructor(cause?: Error, context?: ErrorContext);
class DocumentNotLockedError
class DocumentNotLockedError extends CouchbaseError {}
Indicates that the referenced document is not locked. Generally raised when an unlock operation is performed.
Error Handling
constructor
constructor(cause?: Error, context?: ErrorContext);
class DocumentUnretrievableError
class DocumentUnretrievableError extends CouchbaseError {}
Indicates that the referenced document could not be retrieved.
Error Handling
constructor
constructor(cause?: Error, context?: ErrorContext);
class DurabilityAmbiguousError
class DurabilityAmbiguousError extends CouchbaseError {}
Indicates that the durable operation that was performed has failed ambiguously and may or may not have completed, or may complete in the future.
Error Handling
constructor
constructor(cause?: Error, context?: ErrorContext);
class DurabilityImpossibleError
class DurabilityImpossibleError extends CouchbaseError {}
Indicates that a durability level which is impossible to achieve was specified. This can occur when you try to use Majority but there is less than the majority of nodes available.
Error Handling
constructor
constructor(cause?: Error, context?: ErrorContext);
class DurabilityLevelNotAvailableError
class DurabilityLevelNotAvailableError extends CouchbaseError {}
Indicates that a durability level which is not available was specified.
Error Handling
constructor
constructor(cause?: Error, context?: ErrorContext);
class DurableWriteInProgressError
class DurableWriteInProgressError extends CouchbaseError {}
Indicates that a write was failed as an existing durable write against that key is already in progress.
Error Handling
constructor
constructor(cause?: Error, context?: ErrorContext);
class DurableWriteReCommitInProgressError
class DurableWriteReCommitInProgressError extends CouchbaseError {}
Indicates that a write was failed as the server is currently reconstructing it's durable data following a failover.
Error Handling
constructor
constructor(cause?: Error, context?: ErrorContext);
class EncodingFailureError
class EncodingFailureError extends CouchbaseError {}
Indicates that there was a failure during encoding.
Error Handling
constructor
constructor(cause?: Error, context?: ErrorContext);
class ErrorContext
class ErrorContext {}
Generic base class for all known error context types.
Error Handling
class EventingFunction
class EventingFunction {}
Describes an eventing function.
Management
constructor
constructor(v: EventingFunction);
property bucketBindings
bucketBindings: EventingFunctionBucketBinding[];
The buckets to bind to the function.
property code
code: string;
The code for this eventing function.
property constantBindings
constantBindings: EventingFunctionConstantBinding[];
The constants to bind to the function.
property enforceSchema
enforceSchema?: boolean;
Whether to enable stricter validation of settings and configuration.
property functionInstanceId
functionInstanceId?: string;
The unique id for the deployment of the handler.
property handlerUuid
handlerUuid?: number;
The unique ID for this eventing function.
property metadataKeyspace
metadataKeyspace: EventingFunctionKeyspace;
The keyspace to store the functions metadata.
property name
name: string;
The name of the eventing function.
property settings
settings: EventingFunctionSettings;
The settings for this function.
property sourceKeyspace
sourceKeyspace: EventingFunctionKeyspace;
The keyspace that the function should operate on.
property urlBindings
urlBindings: EventingFunctionUrlBinding[];
The URLs to bind to the function.
property version
version?: string;
The authoring version of this eventing function.
class EventingFunctionBucketBinding
class EventingFunctionBucketBinding {}
Specifies a bucket binding for an eventing function.
Management
constructor
constructor(v: EventingFunctionBucketBinding);
property access
access: EventingFunctionBucketAccess;
The level of access configured for this binding.
property alias
alias: string;
The alias to use for referring to this binding.
property name
name: EventingFunctionKeyspace;
The keyspace that this binding refers to.
class EventingFunctionCompilationFailureError
class EventingFunctionCompilationFailureError extends CouchbaseError {}
Indicates that the eventing function was not able to be compiled.
Error Handling
constructor
constructor(cause?: Error, context?: ErrorContext);
class EventingFunctionConstantBinding
class EventingFunctionConstantBinding {}
Specifies a constant binding for an eventing function.
Management