A newer version of this documentation is available.

View Latest

Extended Attributes

    Couchbase Server permits the definition of extended attributes. These allow developers to define application-specific metadata visible only to those applications that request it or attempt to modify it. This might be, for example, metadata specific to a programming framework that should be hidden by default from other frameworks, or possibly from other versions of the same framework.

    Definition, Access, and Discovery

    The Couchbase SDK supports applications' creation and modification of extended attributes (sometimes referred to as XATTRs). This is achieved by extensions to the Sub-Document API (see Sub-Documents). Extended attributes can be formed only as JSON, but can be applied to both JSON and binary items.

    The creator-application can subsequently access and modify the extended attributes it has created within a document. However, no other application has knowledge of the extended attributes within a document other than their creator; unless such knowledge is shared explicitly between applications by some mechanism external to Couchbase Server.

    Implications for Sizing

    Within Couchbase Server, the maximum size for each document is 20 megabytes (see the section Size Limits, on the page Data). Extended attributes count against this size-limit: consequently, the size of a document may reflect the presence of data inaccessible to some applications.

    Virtual Extended Attributes

    A virtual extended attribute (sometimes referred to as a VXATTR) exposes additional information about a document. Couchbase Server provides a single virtual extended attribute, $document, which, when specified as a search-path, returns metadata on the document. Ouput might appear as follows: