PrismaP
Prisma13mo ago
9 replies
Saturn 🪐

getting data from prismaClient says field might be null when it literally isn't in the schema

i have this in my schema
model products {
  id             Int       @id @default(autoincrement())
  //some fields
  recommended    Boolean   @default(false)  
  //more fiels
}


so recommended is obviously NON NULL and it has a default value, i even see in my database as non null, but when i get the data from prismaClient it says that recommended is of type boolean | null

  const data = await prismaClient.products.findMany({
    where: {
      recommended: true,
    },
    select:{
      id:true,
      //other fields
      recommended:true,
    }
  });
image.png
Was this page helpful?