Model
API reference for the Model class
Constructor
Internal — models are created by Collection._toModel().
Model uses a Proxy to expose record fields as direct properties.
Properties
model.id: ID
All record fields are accessible as properties:
user.name
user.email
// etc.
Methods
update()
update(changes: Partial<T>): Promise<Model<T>>
Calls collection.update(this.id, changes).
delete()
delete(): Promise<void>
Calls collection.delete(this.id).
toJSON()
toJSON(): T
Returns a plain copy of the data — no methods or proxy.
Relation getters
Auto-attached when the schema defines relations and the relations plugin is active.
Each getter returns a QueryBuilder pre-filtered to match the relation.
How is this guide?
Last updated on Jun 20, 2026