What is the difference between embedsMany and hasMany in the Strongloop loop

At first glance, they seem to be doing the same thing: define a one-to-many relationship. So why would you choose one or the other?

+5
source share
1 answer

EmbedsMany - a model that includes many instances of another model; for example, the Client may have several email addresses, and each email address is a complex object that contains a label and an address. The hasMany relationship creates a one-to-many relationship with another model.

EmbedsMany includes all children in the same parent, HasMany stores the children separately and has the property as a foreign key to reference the declaring model.

+7
source

All Articles