Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Collection

Exposes the operations which are available to be performed against a collection. Namely the ability to perform KV operations.

Hierarchy

  • Collection

Index

Accessors

name

  • get name(): string
  • The name of the collection this Collection object references.

    Returns string

Methods

binary

  • Returns a BinaryCollection object reference, allowing access to various binary operations possible against a collection.

    Returns BinaryCollection

exists

  • Checks whether a specific document exists or not.

    Parameters

    • key: string

      The document key to check for existence.

    • Optional options: ExistsOptions

      Optional parameters for this operation.

    • Optional callback: NodeCallback<ExistsResult>

      A node-style callback to be invoked after execution.

    Returns Promise<ExistsResult>

get

  • Retrieves the value of a document from the collection.

    Parameters

    • key: string

      The document key to retrieve.

    • Optional options: GetOptions

      Optional parameters for this operation.

    • Optional callback: NodeCallback<GetResult>

      A node-style callback to be invoked after execution.

    Returns Promise<GetResult>

getAllReplicas

  • Retrieves the value of the document from all available replicas. Note that as replication is asynchronous, each node may return a different value.

    Parameters

    Returns Promise<GetReplicaResult[]>

getAndLock

  • Locks a document and retrieves the value of that document at the time it is locked.

    Parameters

    • key: string

      The document key to retrieve and lock.

    • lockTime: number

      The amount of time to lock the document for, specified in seconds.

    • Optional options: GetAndLockOptions

      Optional parameters for this operation.

    • Optional callback: NodeCallback<GetResult>

      A node-style callback to be invoked after execution.

    Returns Promise<GetResult>

getAndTouch

  • Retrieves the value of the document and simultanously updates the expiry time for the same document.

    Parameters

    • key: string

      The document to fetch and touch.

    • expiry: number

      The new expiry to apply to the document, specified in seconds.

    • Optional options: GetAndTouchOptions

      Optional parameters for this operation.

    • Optional callback: NodeCallback<GetResult>

      A node-style callback to be invoked after execution.

    Returns Promise<GetResult>

getAnyReplica

  • 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.

    Parameters

    Returns Promise<GetReplicaResult>

insert

  • Inserts a new document to the collection, failing if the document already exists.

    Parameters

    • key: string

      The document key to insert.

    • value: any

      The value of the document to insert.

    • Optional options: InsertOptions

      Optional parameters for this operation.

    • Optional callback: NodeCallback<MutationResult>

      A node-style callback to be invoked after execution.

    Returns Promise<MutationResult>

list

  • Returns a CouchbaseList permitting simple list storage in a document.

    Parameters

    • key: string

      The document key the data-structure resides in.

    Returns CouchbaseList

lookupIn

  • Performs a lookup-in operation against a document, fetching individual fields or information about specific fields inside the document value.

    Parameters

    • key: string

      The document key to look in.

    • specs: LookupInSpec[]

      A list of specs describing the data to fetch from the document.

    • Optional options: LookupInOptions

      Optional parameters for this operation.

    • Optional callback: NodeCallback<LookupInResult>

      A node-style callback to be invoked after execution.

    Returns Promise<LookupInResult>

map

  • Returns a CouchbaseMap permitting simple map storage in a document.

    Parameters

    • key: string

      The document key the data-structure resides in.

    Returns CouchbaseMap

mutateIn

  • Performs a mutate-in operation against a document. Allowing atomic modification of specific fields within a document. Also enables access to document extended-attributes.

    Parameters

    • key: string

      The document key to mutate.

    • specs: MutateInSpec[]

      A list of specs describing the operations to perform on the document.

    • Optional options: MutateInOptions

      Optional parameters for this operation.

    • Optional callback: NodeCallback<MutateInResult>

      A node-style callback to be invoked after execution.

    Returns Promise<MutateInResult>

queue

  • Returns a CouchbaseQueue permitting simple queue storage in a document.

    Parameters

    • key: string

      The document key the data-structure resides in.

    Returns CouchbaseQueue

remove

  • Remove an existing document from the collection.

    Parameters

    • key: string

      The document key to remove.

    • Optional options: RemoveOptions

      Optional parameters for this operation.

    • Optional callback: NodeCallback<MutationResult>

      A node-style callback to be invoked after execution.

    Returns Promise<MutationResult>

replace

  • Replaces the value of an existing document. Failing if the document does not exist.

    Parameters

    • key: string

      The document key to replace.

    • value: any

      The new value for the document.

    • Optional options: ReplaceOptions

      Optional parameters for this operation.

    • Optional callback: NodeCallback<MutationResult>

      A node-style callback to be invoked after execution.

    Returns Promise<MutationResult>

set

  • Returns a CouchbaseSet permitting simple set storage in a document.

    Parameters

    • key: string

      The document key the data-structure resides in.

    Returns CouchbaseSet

touch

  • Updates the expiry on an existing document.

    Parameters

    • key: string

      The document key to touch.

    • expiry: number

      The new expiry to set for the document, specified in seconds.

    • Optional options: TouchOptions

      Optional parameters for this operation.

    • Optional callback: NodeCallback<MutationResult>

      A node-style callback to be invoked after execution.

    Returns Promise<MutationResult>

unlock

  • Unlocks a previously locked document.

    Parameters

    • key: string

      The document key to unlock.

    • cas: any

      The CAS of the document, used to validate lock ownership.

    • Optional options: UnlockOptions

      Optional parameters for this operation.

    • Optional callback: NodeCallback<void>

      A node-style callback to be invoked after execution.

    Returns Promise<void>

upsert

  • Upserts a document to the collection. This operation succeeds whether or not the document already exists.

    Parameters

    • key: string

      The document key to upsert.

    • value: any

      The new value for the document.

    • Optional options: UpsertOptions

      Optional parameters for this operation.

    • Optional callback: NodeCallback<MutationResult>

      A node-style callback to be invoked after execution.

    Returns Promise<MutationResult>

Generated using TypeDoc