ποΈ Identity Map
MikroORM uses identity map in background, so we will always get the same instance of one entity.
ποΈ Collections
OneToMany and ManyToMany properties are stored in a Collection wrapper.
ποΈ Type-Safe Relations
Entity relations are mapped to entity references - instances of the entity that have at least the primary key available. This reference is stored in identity map, so you will get the same object reference when fetching the same document from database.
ποΈ Entity Repository
Entity Repositories are thin layers on top of EntityManager. They act as an extension point, so we can add custom methods, or even alter the existing ones. The default, EntityRepository implementation just forwards the calls to underlying EntityManager instance.
ποΈ Transactions and Concurrency
Starting v3.4, transactions are also supported in MongoDB driver.
ποΈ Inheritance Mapping
Mapped Superclasses
ποΈ Cascading
From v4.2, cascade merging is no longer configurable (and is kept enabled for all relations).
ποΈ Filters
MikroORM has the ability to pre-define filter criteria and attach those filters to given entities. The application can then decide at runtime whether certain filters should be enabled and what their parameter values should be. Filters can be used like database views, but they are parameterized inside the application.
ποΈ Deployment
Under the hood, MikroORM uses ts-morph to read TypeScript source files of all entities to be able to detect all types. Thanks to this, defining the type is enough for runtime validation.
ποΈ Using Query Builder
Since v4, we need to make sure we are working with correctly typed EntityManager or EntityRepository to have access to createQueryBuilder() method.
ποΈ Result cache
MikroORM has simple result caching mechanism. It works with those methods of EntityManager: find(), findOne(), findAndCount(), findOneOrFail(), count(), as well as with QueryBuilder result methods (including execute).
ποΈ Logging
For development purposes it might come handy to enable logging and debug mode: