Content & privacy
Backend · INTERVIEW GUIDE

NestJS

Dependency injection, request lifecycle, validation, and database integration.

Practice this topic
Filters
5 questions

TypeORM vs Sequelize vs Mongoose?

NestJS·Database integration

TypeORM and Sequelize are object-relational mappers for relational databases, while Mongoose models documents in MongoDB. They provide convenient data-access APIs but do not replace database knowledge. The generated queries, constraints and transaction behavior still determine correctness and performance.

Intermediate2 min read

Repository vs QueryBuilder vs raw SQL?

NestJS·Database integration

A repository exposes common operations around an entity, QueryBuilder assembles more flexible database queries, and raw SQL gives direct control over SQL text. These are levels of access rather than a ranking from bad to good. Use the simplest approach that expresses the required query clearly and efficiently.

Intermediate2 min read

How should a TypeORM transaction work?

NestJS·Database integration

A transaction groups database changes so they can commit together or roll back together. In TypeORM, the transaction callback receives a manager tied to that transaction's connection. Queries issued through an unrelated global repository may not participate, even if they appear inside the same JavaScript callback.

Intermediate2 min read

What are N+1, eager loading and lazy loading?

NestJS·Database integration

N+1 is a data-access pattern where fetching N parent records leads to roughly N more queries for related records. Eager loading fetches configured relations up front, while lazy loading waits until the relation is accessed. Both loading styles can waste work if they do not match the endpoint's real needs.

Intermediate2 min read

Why use migrations instead of automatic schema sync?

NestJS·Database integration

A migration is a versioned database change that can be reviewed and applied deliberately. Automatic schema synchronization tries to match the schema to entity definitions and may make changes without a safe production rollout plan. Migrations make data changes, compatibility and deployment order explicit.

Intermediate2 min read

Difficulty is an editorial estimate. Completion means you chose to mark a question as understood.