CompatCollection
The idea of CompatCollection
and CompatModel
is to make migration from mobx-collection-store
and mobx-jsonapi-store
simpler.
Note: They should be used for migration only, and once you switch to datx
, you should refactor your collections and models to use Model
or PureModel
. The usage of this class will emit deprecation warnings during development to make migration easier.
CompatCollection
enhances the Collection
with the following properties and methods:
- type getters: If you have a model of type person, you can get all models of the type by using
collection.person
. This is an equivalent to thefindAll
method:collection.findAll('person')
orcollection.findAll(Person)
. static: typeof CompatCollection
- Getter for the collection class. Mostly for internal use.toJS
- Equivalent to thetoJSON
method.