TypeORM Docs
DataSource1- intialize
- destroy
- .manager
- .getRepository()
DataSourceOptions- type
- extra
- entities
- migrations
- synchronize2
- schema:sync
- other and defenitions
- Example
Entity3- alternative table name
@Column@PrimaryColumn()@PrimaryGeneratedColumn()- uuid
save()4
Links
Footnotes
-
Your interaction with the database is only possible once you setup a
DataSource. TypeORM'sDataSourceholds your database connection settings and establishes initial database connection or connection pool depending on the RDBMS you use. ↩ -
synchronize- Indicates if database schema should be auto created on every application launch. Be careful with this option and don't use this in production - otherwise you can lose production data. This option is useful during debug and development. As an alternative to it, you can use CLI and run schema:sync command. Note that for MongoDB database it does not create schema, because MongoDB is schemaless. Instead, it syncs just by creating indices. ↩ -
Entity is a class that maps to a database table (or collection when using MongoDB). You can create an entity by defining a new class and mark it with
@Entity(): ↩ -
When you save entities using
saveit always tries to find an entity in the database with the given entity id (or ids). If id/ids are found then it will update this row in the database. If there is no row with the id/ids, a new row will be inserted. ↩