Attribute pattern - Limit on arrays and different value types for the same key

Hello,
After watch the video about attribute pattern, I have a couple of questions:

  1. Is it there any limit for array size? for example, lets say we have products with more than 800 attributes. Is it good?
{
  _id: ObjectId("...."),
  name: "product1",
  attributes: [
    {"k": "color", "v": "red"},
    {"k": "price", "v": "200"},
    {"k": "description", "v": "this is a product"},
.....
    {"k": "description_for_amazon", "v": "this is a product in amazon"},
  ]
}
  1. Do we need some kind of homogeneity for different products for the same key?. I mean, Can we have this scenario?
{
  _id: ObjectId("...."),
  name: "product1",
  attributes: [
    {"k": "color", "v": "red"},
    {"k": "price", "v": 200},
  ]
},
{
  _id: ObjectId("...."),
  name: "product2",
  attributes: [
    {"k": "color", "v": "blue"},
    {"k": "price", "v":"12 euros"},
  ]
}

If one have a product collection that has more than 800 attributes and decide to use attributes pattern to implement the schema, this definitely not a good idea. My understanding the attribute pattern is more like a variant of schema versioning pattern, that you can use it to save products that has small differences. but the scale like 50 - 800 attributes that’s obviously too many, you may consider patterns like subset or outlier or split the product schema into 2 or more schema types.

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.