DefaultValuePipe is a built-in NestJS pipe that provides a default value when a parameter is null or undefined. It is used before Parse* pipes to handle missing optional parameters:
@Get()
async findAll(
@Query('activeOnly', new DefaultValuePipe(false), ParseBoolPipe) activeOnly: boolean,
@Query('page', new DefaultValuePipe(0), ParseIntPipe) page: number,
) {
// activeOnly defaults to false, page defaults to 0
}Without DefaultValuePipe, Parse* pipes throw an exception on null/undefined values.