noSQL and normalised data noSQL and normalised data mongodb mongodb

noSQL and normalised data


The general answer to this question: There is no general answer to this question.

The point is that in NoSQL, the data structure is not dictated by the data, but rather by the queries the data structure must support. So, rather than using the same pattern for each and every instance of a 1:N or M:N association problem, the NoSQL way is to use different patterns depending on your specific needs. These could be, for instance:

  • Write/Read Ratio
  • Specific database features that make embedding easier or harder
  • The types of queries you need to support
  • Performance considerations on how the data can be indexed, sharded, federated or in any other way split or cached

Generally, my feeling is that beginners tend to 'over-embed', but I can speak for MongoDB only. Embedding is a powerful feature, but embedded objects are not 'first-class citizens', so it shouldn't be used as a replacement for every 1:n relation. Only for some :)