$ ./guess_the_languageSQL & Databases
SQL & Databases · medium · #60

In MongoDB, when is embedding a sub-document usually better than referencing another collection?

  1. Grows without any upper limit
  2. Read together, small and bounded
  3. Shared by many parent documents
  4. Updated far more than it is read
Embed data that is fetched with its parent and stays small; reference data that is shared or unbounded (16 MB doc limit).
Play SQL & Databases ▸