XATTR and Virtual XATTR

  • concept
    Extended Attributes (XATTR) are metadata that can be provided on a per-application basis.

    Using Extended Attributes

    The SDK supports extended attributes by means of extensions to the Sub-Document API: so that extended attributes can be defined, searched for, edited, removed, and more. In order to specify that a subdocument operation should be performed on an extended rather than a regular attribute, an xattr flag should be set to true, by the calling application. For detailed information on the Subdocument API, see Subdocument Operations, and the accompanying practical doc.

    For more information, see Extended Attributes.

    The maximum content size for a document stored in Couchbase Server is 20MB. XATTRs — including Virtual XATTRs — will reduce the space available for the remainder of the document.

    Virtual Extended Attributes

    Virtual extended attributes consist of metadata on an individual document: this can be retrieved by specifying $document as a search-path — see below. See the Virtual XATTR Section for more information on the metadata that they expose.

    These attributes are generated on-demand to expose storage-level document metadata, such as expiry to expose document expiration. For expiry using Virtual XATTR, use the following: