What is the purpose of a Model in Mongoose?
To create and manage database migrations
To interact with a specific collection in the database based on a defined schema
To define a database connection string
To handle user authentication and authorization
Which testing type provides the most comprehensive coverage by simulating real user interactions with a running NestJS application?
Integration Testing
End-to-End (E2E) Testing
Regression Testing
Unit Testing
Which built-in Pipe is suitable for automatically validating incoming requests against a TypeScript class?
ParseBoolPipe
ValidationPipe
DefaultValuePipe
ParseIntPipe
Why are database migrations important in a NestJS application using TypeORM?
To automatically generate frontend UI components
To manage user sessions
To handle HTTP requests and responses
To track and apply changes to the database schema over time
What is the typical role of a @SetMetadata decorator when working with custom Guards in NestJS?
@SetMetadata
It defines the structure of the response sent back to the client.
It attaches custom metadata to route handlers, which can be accessed within the Guard to make authorization decisions.
It is used to inject dependencies into Guards.
It directly handles user authentication logic.
Which decorator type in NestJS is specifically designed to intercept and modify method arguments?
Parameter Decorator
Property Decorator
Class Decorator
Method Decorator
In a NestJS microservice architecture, how do services typically communicate with each other asynchronously?
Database triggers
Direct method calls
Shared memory
Message queues
What is the purpose of the @nestjs/testing package in NestJS?
@nestjs/testing
Facilitates the deployment of NestJS applications to various cloud platforms
Offers tools for performance profiling and optimization of NestJS code
Provides utilities and helpers specifically designed for testing NestJS applications
Enables integration with external continuous integration and delivery (CI/CD) pipelines
How can you apply a transformation interceptor to a specific method in a controller in NestJS?
By registering the interceptor globally in the app.module.ts file
app.module.ts
By extending the BaseController class and applying the interceptor in the constructor
BaseController
By using the @Transform() decorator above the controller class
@Transform()
By using the @UseInterceptors() decorator at the method level
@UseInterceptors()
When designing a microservice using NestJS, what is a recommended practice for ensuring service discovery?
Using a service registry (e.g., Consul, etcd)
Hardcoding service addresses
Manually updating configuration files
Relying on client-side load balancing