You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
and also a few other variations but none of them seem to give me back any results. I have previewFeatures = ["orderByRelation", "filterJson"] so this should be good to go. Please let me know if I'm doing something wrong.
I can reproduce this with 2.29.0-dev.5. We need to define behavior here whether this filter will be limited to the path key or not. If so the behavior is correct, otherwise it is not.
This is not a bug, but a side effect of how SQL databases handle the path extraction and nulls.
This is your test data:
{"test", "test"}
{"foo", "bar"}
Your query searches for path: ["test"], not: "test".
What happens: {"foo", "bar"} doesn't have the path "test" at all, which results in a path extraction result of NULL in the database. You may know that any comparator featuring null on any side (like NULL != "test") is always false, so the row {"foo", "bar"} is not returned, because it doesn't match. It's the same really in other filter operations: If you have one row with NULL and one with "value" in one column, and you check for not: "value" you will not get the NULL row, instead you need to add a compound filter to check for the NULL separately: OR: [ { col: null }, { col: { not: "value" } } ].
Tl;dr: You need to write:
constentries=awaitthis.prismaClient.obj.findMany({where: {OR: [{values: {path: ["test"],not: "test",},},{values: {path: ["test"],equals: Prisma.DbNull,// Or similar, see the API changes in the Prisma 3 release to filter for nulls.},}]},});
Activity
pantharshit00 commentedon Jul 29, 2021
I can reproduce this with
2.29.0-dev.5. We need to define behavior here whether this filter will be limited to thepathkey or not. If so the behavior is correct, otherwise it is not.dpetrick commentedon Oct 11, 2021
This is not a bug, but a side effect of how SQL databases handle the path extraction and nulls.
This is your test data:
{"test", "test"}{"foo", "bar"}Your query searches for
path: ["test"], not: "test".What happens:
{"foo", "bar"}doesn't have the path"test"at all, which results in a path extraction result ofNULLin the database. You may know that any comparator featuring null on any side (likeNULL != "test") is always false, so the row{"foo", "bar"}is not returned, because it doesn't match. It's the same really in other filter operations: If you have one row withNULLand one with"value"in one column, and you check fornot: "value"you will not get theNULLrow, instead you need to add a compound filter to check for theNULLseparately:OR: [ { col: null }, { col: { not: "value" } } ].Tl;dr: You need to write: