First approach is better, because you can easily add/remove/update items in your roles
array using array operators like $push
, $pull
etc.
Also, indexing the first type is easier, as you'd just index roles
field.
For the next option, if you want to specifically index each type of role, you will have to create a lot of indexes.
So my vote will be for first!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…