At first sight they seem to do the same thing: define a one-to-many relation So why would you choose one or another?
Asked
Active
Viewed 1,714 times
1 Answers
9
EmbedsMany - a model that embeds many instances of another model; for example, a Customer can have multiple email addresses and each email address is a complex object that contains label and address. A hasMany relation builds a one-to-many connection with another model.
EmbedsMany embeds all child objects in the same parent object, HasMany stores child objects separately and has a property as the foreign key to reference the declaring model.

snathan
- 525
- 2
- 7
-
1I'm using MySQL, I'm guessing this only applies for document databases like MongoDB? – Ernie Jun 12 '15 at 06:35
-
2@Ernie - the backend DB doesn't really matter, mysql will happily store a stringified JSON array or object in a column – notbrain Jun 12 '15 at 17:04