Models & Persistence
A model is a plain class with @Entity/@DataStore on it and @Column on its fields, the same class works whether it ends up in MongoDB or a SQL database (via TypeORM), with no separate schema file and no repository boilerplate to write by hand.
@Entity()
@DataStore('mongo')
export class Pet extends BaseMongoEntity {
@Column()
name: string = '';
}
That's a complete, persistable model. Combined with a CRUDRoute (see Auto CRUD Routes), it's also a complete REST API, list/get/create/update/delete, with no query code written anywhere.
- Entities & Columns —
@Entity,@Column,@PrimaryColumn,@Index,@Unique. - Validation —
@Validator,@Nullable, and the built-in checks that run automatically on every create and update. - Datastores & Connections —
@DataStore, and connecting to MongoDB/SQL/Redis. - Repository & RepoUtils — direct entity access, and when to reach for the raw ORM repository instead of the ACL/cache-aware
RepoUtils. - Transactions —
@Transactional, nested transactions, and compensating rollbacks across connections. - Base Entities — the base classes to extend, plus
@TrackChangesand@ChildEntity. - Caching & Sharding —
@Cacheand@Shard.