What is the role of the 'transform()' method within a custom Pipe in NestJS?
It defines the metadata associated with the Pipe.
It determines if the Pipe should be applied globally.
It contains the logic to transform the input data.
It specifies how the Pipe should handle errors.
What decorator is used to register a caching interceptor globally in a NestJS application?
@UseInterceptors(CacheInterceptor)
@Cache()
@GlobalCache()
@GlobalInterceptor(CacheInterceptor)
What is the role of the catch() method in a custom HTTP exception filter?
catch()
It re-throws the exception to be handled by a global exception filter.
It handles the exception and sends a customized error response.
It logs the exception to the console.
It determines the appropriate HTTP status code for the exception.
How can you apply a Pipe globally to all route handlers in a NestJS application?
By providing the Pipe in the 'providers' array of the AppModule.
By using the @Global() decorator on the Pipe class.
By registering the Pipe in the 'pipes' array within the @Controller() decorator.
By using the 'useGlobalPipes()' method in the 'main.ts' file.
What is the typical role of a @SetMetadata decorator when working with custom Guards in NestJS?
@SetMetadata
It directly handles user authentication logic.
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.
In Mongoose, what is a Schema?
A representation of a database connection
A configuration file for a NestJS application
A definition of the structure and data types for documents in a collection
A method for handling HTTP requests
What is a common approach to ensure data consistency when using CQRS and event-driven architecture in NestJS?
Using two-phase commit transactions for command and event handling
Disabling caching mechanisms to guarantee real-time data consistency
Implementing eventual consistency by updating read models asynchronously
Relying on the database's built-in transaction management system
What is the primary purpose of custom decorators in NestJS?
To directly modify the underlying Express.js request and response objects.
To define custom middleware functions within a controller.
To enforce strict type checking at compile time.
To enhance code reusability and readability by encapsulating common logic.
In NestJS, which decorator is used to define a microservice?
@Module()
@Controller()
@Injectable()
@Microservice()
Which built-in Pipe is suitable for automatically validating incoming requests against a TypeScript class?
ValidationPipe
ParseBoolPipe
DefaultValuePipe
ParseIntPipe