Attribute pattern

Reference type:Cheat sheetFormat:Syntax + example + use case

Reference group: Schema patterns

What it does

Avoids a large sparse set of optional fields.

Syntax

Represent variable properties as key/value entries

Use case

Catalogs with category-specific attributes.

Important notes

Plan indexing and type consistency.

Attribute pattern: practical example
{ name: "Laptop", attributes: [{ key: "ram", value: "16GB" }, { key: "storage", value: "512GB" }] }
💡 Explanation Avoids a large sparse set of optional fields. When to use it Catalogs with category-specific attributes. Caution Plan indexing and type consistency.
Key Takeaways
  • Avoids a large sparse set of optional fields.
  • Typical use: Catalogs with category-specific attributes.