Extended Attributes: Fundamentals

Extended Attributes: Fundamentals

Couchbase Server permits the definition of extended attributes. These allow application 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 the creation and modification of extended attributes by applications written in Node.js, Java, .NET, PHP, Python, Go, and C. This is achieved by extensions to the Subdocument API.

The creator-application can subsequently access and modify the extended attributes it has created within a document. However, Couchbase Server 5.0 provides no facility for enumerating or sharing knowledge of extended attributes: therefore, no 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 5.0.

Implications for Sizing

Within Couchbase Server, the maximum size for each individual document is 20 megabytes (see Cluster Operations). 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 exposes additional information about a document. Couchbase Server 5.0 provides a single virtual extended attribute, $document, which, when specified as a search-path, returns metadata on the document. Ouput might appear as follows: