Search code examples
node.jsnestjstypeorm

TypeORM use `.returning` with all visible fields


In my query, all fields are being returned because I'm using .returned("*"), even those that are marked with @Exclude. Is there a way I can apply .returned("*") but return only visible fields?


Solution

  • I'm using Nest.js and the problem for me was that I didn't include @UseInterceptors(ClassSerializerInterceptor) in my controller. This got rid of all excluded fields.