User's skills data structure

Hi everyone, newbie to mongo… :upside_down_face:

I want to add a list of skills to my users. A skill is not only the name of the skill, but also an object with some more info about the skill - how rare is it, the source of the skill, skill rate for this user and so on…

At the end - I’ll get a list of skills and I want to find all users with one or more of those skills. I might also want to do some calculation on the skill data in order to give it some grade (but this is not critical, I can do it in the code as well).

My question - what is the best structure for keeping those skills - array of objects where the skill name is one of the attributes of the nested object, or an object where each key is the skill name and the value is the skills attributes?

What search function should I use?

It’s an offline process, so it doesn’t have to be super fast.
I expect 5K-50K of users in the collection.

Thanks! :sauropod:

I would go with the attribute pattern:

something like:

skills : [
  { skill_name : "magic" ,  strength : 5   } ,
  { skill_name : "fire maker" ,   strength : 10   } 
]
2 Likes

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