Fetch data from types that mixin a type

#1

Can a single fetch call retrieve persisted data from all types that mixin a particular type (say, PersistableType).

Would a fetch on PersistableType also return objs from types that extend it and/or types that mix it? If not, how can it be done?

0 Likes

#2

A single fetch can retrieve persisted data from all types that EXTEND a particular PERSISTABLE type. (type Persistable does NOT mixin Persistable)

For example if type Facility extends FixedAsset, then FixedAsset.fetch() will ALSO return all Facility instances.

To fetch everything that mixes in a particular non-persistable type, you could consider something like:

MetadataStore.tag().typesThatMixin("AType").each(function(type) {
  type.fetch()
})
1 Like