Question · NestJS course · Module 3: TypeORM and Databases

BeforeInsert hook

What is the @BeforeInsert() decorator on an entity method used for?

Answer options

  • Executes logic before deleting a record
  • Automatically executes logic before saving a new record to the database
  • Blocks insertion of new records
  • Creates a backup before the insert

You can check the correct answer by solving this task in the CodeWorlds game.