not filter not working as doc says here
await prisma.post.findMany({
where: {
content: {
not: { contains: "sample" },
},
},
});
Error happened PrismaClientValidationError:
Invalid `prisma.post.findMany()` invocation in
/home/galala/projects/prisma-examples/typescript/rest-express/src/index.ts:24:23
{
where: {
content: {
not: {
contains: 'sample'
}
~~~~~~~~~~~~~~~~~~~~
}
}
}
Argument not: Got invalid value
{
contains: 'sample'
}
on prisma.findManyPost. Provided Json, expected String or null or NullableStringFilter.
https://github.com/mohamedGamalAbuGalala/prisma-bugs
query with not is supposed to work as expected in docs and in typedef not?: string | StringFilter | null
Do you want "NOT" as boolean expression?
If yes then you need an array here.
Hence, the right syntax will be
await prisma.post.findMany({
where: {
NOT: [ content:{
contains: "sample"
}],
},
});
For more refer this.
@RitikDua
Your example is not working with the typedef

The problem here is that typedef has the definition of not as not?: string | StringFilter | null
So this example should work and it is accepted by typedef but it doesn't in runtime and it throws the error I posted in the issue description.
await prisma.post.findMany({
where: {
content: {
not: { contains: "sample" },
},
},
});
The problem here is that typedef has the definition of
notasnot?: string | StringFilter | nullSo this example should work and it is accepted by typedef but it doesn't in runtime and it throws the error I posted in the issue description.
await prisma.post.findMany({ where: { content: { not: { contains: "sample" }, }, }, });
sorry , i did a little mistake there . Actually,you need not in Capital letters.
Hence you need it as NOT
I know that NOT will work for me.
@pantharshit00 what kind of info do you need?
I updated the issue description to include a link to code sandbox
Hey @mohamedGamalAbuGalala
I was waiting for you to respond to @RitikDua's comment so that is why I added that label.
Also, I am unable to reproduce this with 2.6.0, the provided example works.
I was having trouble running it on codesandbox so I made a repl it with working example: https://repl.it/@HarshitPant/prisma-issue-833#src/index.ts
So please try this once again with latest version.
Confirming that the bug is no longer exist in 2.6.0 (sandbox)