1

I use mongo for saving my attributes , now the question is i want to save the attributes like this

  {
    title:"new product"
    ...
    ...
    attr:[
           {
             name:"color",value:"red"
           },
           {
              name:"size",value:6
           },
           ....
        ]

  }

now if i create index for value field is it bad index design? should i separate the integer fields from string fields and then index separately ?

babak faghihian
  • 1,169
  • 2
  • 13
  • 24

1 Answers1

0

MongoDB encapsulates features of dynamic schema which supports variance of different data types across documents in MongoDB collection. Regarding concern mentioned above to store values with different data types in one field ,I suggest that it can be stored and its main purpose for which MongoDB is designed.

Rubin Porwal
  • 3,736
  • 1
  • 23
  • 26