couchbase
    Preparing search index...

    Class Collection

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

    Index

    Accessors

    • get name(): string

      The name of the collection this Collection object references.

      Returns string

    Methods

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

      Returns BinaryCollection

    • Retrieves the value of a document from the collection.

      Parameters

      • key: string

        The document key to retrieve.

      • Optionaloptions: GetOptions

        Optional parameters for this operation.

      • Optionalcallback: NodeCallback<GetResult>

        A node-style callback to be invoked after execution.

      Returns Promise<GetResult>

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

      • Optionaloptions: GetAndLockOptions

        Optional parameters for this operation.

      • Optionalcallback: NodeCallback<GetResult>

        A node-style callback to be invoked after execution.

      Returns Promise<GetResult>

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

      • Optionaloptions: GetAndTouchOptions

        Optional parameters for this operation.

      • Optionalcallback: NodeCallback<GetResult>

        A node-style callback to be invoked after execution.

      Returns Promise<GetResult>

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

      • Optionaloptions: InsertOptions

        Optional parameters for this operation.

      • Optionalcallback: NodeCallback<MutationResult>

        A node-style callback to be invoked after execution.

      Returns Promise<MutationResult>

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

      Parameters

      • key: string

        The document key the data-structure resides in.

      Returns CouchbaseList

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

      • Optionaloptions: LookupInOptions

        Optional parameters for this operation.

      • Optionalcallback: NodeCallback<LookupInResult>

        A node-style callback to be invoked after execution.

      Returns Promise<LookupInResult>

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

      Parameters

      • key: string

        The document key the data-structure resides in.

      Returns CouchbaseMap

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

      • Optionaloptions: MutateInOptions

        Optional parameters for this operation.

      • Optionalcallback: NodeCallback<MutateInResult>

        A node-style callback to be invoked after execution.

      Returns Promise<MutateInResult>

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

      Parameters

      • key: string

        The document key the data-structure resides in.

      Returns CouchbaseQueue

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

      • Optionaloptions: ReplaceOptions

        Optional parameters for this operation.

      • Optionalcallback: NodeCallback<MutationResult>

        A node-style callback to be invoked after execution.

      Returns Promise<MutationResult>

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

      Parameters

      Returns Promise<ScanResult[]>

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

      Parameters

      • key: string

        The document key the data-structure resides in.

      Returns CouchbaseSet

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

      • Optionaloptions: TouchOptions

        Optional parameters for this operation.

      • Optionalcallback: NodeCallback<MutationResult>

        A node-style callback to be invoked after execution.

      Returns Promise<MutationResult>

    • Unlocks a previously locked document.

      Parameters

      • key: string

        The document key to unlock.

      • cas: CasInput

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

      • Optionaloptions: UnlockOptions

        Optional parameters for this operation.

      • Optionalcallback: NodeCallback<void>

        A node-style callback to be invoked after execution.

      Returns Promise<void>

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

      • Optionaloptions: UpsertOptions

        Optional parameters for this operation.

      • Optionalcallback: NodeCallback<MutationResult>

        A node-style callback to be invoked after execution.

      Returns Promise<MutationResult>