Where to store a user related key, in the user collection or in a separate collection?

for a user, there is a key, say type, this is not going to change a lot, like maybe 10 times. But this type is needed in 3-4 places in the application. So is it better to keep type in a separate collection and whenever needed, do a lookup or should I keep it in the user collection itself?
The number of users can be up to 1000.

Hey @S_V2,

Welcome to the MongoDB Community Forums! :leaves:

In general, we use separate collections when:

  1. when embedding would result in huge duplication of data and would also not provide sufficient read performance to outweigh the implications of the duplications.
  2. to represent complex many-to-many relationships.
  3. to model large hierarchical datasets.

Since your data is not frequently changing, and you only need to frequently read it and assuming that you will need user data too along with it, embedding can be recommended as it provides better performance for read operations and requesting and retrieving data in a single database operation would also be possible easily.

I am linking documentation too here to help further cement your understanding of these concepts. Please feel free to reach out for anything else as well.

Data Model Design
Embedding One to Many Relationship
Model One to Many Relationship with Document Reference

Satyam Gupta