Skip to content
Advertisement

How can I have IS NULL condition in TypeORM find options?

In my queries I’m using TypeORM find option. How can I have IS NULL condition in the where clause?

Advertisement

Answer

Another way is you can use IsNull() function, for example:

import { IsNull } from "typeorm";
return await getRepository(User).findOne({
    where: { 
      username: IsNull()
    }
});
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement