向元数据添加关键对象 - Couchbase

Add a key object to metadata - Couchbase

有什么方法可以向 couchbase 中的元数据对象添加 自定义键值对

谢谢。Below image is a screenshot of meta data of one document added in couchbase

列出的元数据特定于 Couchbase。您可以探索扩展属性 (xattr):

https://docs.couchbase.com/server/5.1/developer-guide/extended-attributes-fundamentals.html

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.

所以,是的,如果你愿意,你可以 read/write 到 xattrs。但是:

Couchbase Server 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

您存储在 xattr 中的任何数据都计入文档的总大小限制。 xattr 值应该只在较低的框架级别使用,而不是用于任何类型的业务逻辑或数据。所以,确保你有一个很好的理由成为 reading/writing xattr。 (Couchbase 如何使用它进行 ACID 事务和移动同步的一些示例)。