New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Json
filter, greater than, less than, doing string comparison instead
#7919
Comments
I am unable to reproduce this. Here is the data in the database I used for this reproduction: Reproduction script: import { PrismaClient } from "@prisma/client";
async function main() {
const prisma = new PrismaClient({ log: [{ emit: "event", level: "query" }] });
prisma.$on("query", (e) => {
console.log(e.query, e.params);
});
const data = await prisma.accountEntity.findMany({
where: {
values: {
path: ["test"],
gt: 5,
},
},
});
console.log(data);
prisma.$disconnect();
}
main(); Result:
If you are confusing |
@pantharshit00 I did some experiment feature using this on my application and it seems to have issues if the numbers that are far apart from each other for example here price with 50,100 result with input price greater than equal 40
query
result return 1 row which I expect 2 rows with price 100.
|
@firmanjml That sounds like a bug - optimally directly create a bug report for that which we can reproduce and check. |
Json
filter, greater than, less than, doing string comparison instead
Hi @njfix6, it looks like this bug was also reported in #8224, which was fixed in |
Bug description
When trying to grab all objects of a json field that are greater than a specific values, it does a string comparison instead of a value comparison.
How to reproduce
values
previewFeatures = ["orderByRelation", "filterJson"]
Expected behavior
I would expect this to return all object where values contains a number greater than 5, but instead it is doing a string comparison.
Prisma information
Environment & setup
Prisma Version
The text was updated successfully, but these errors were encountered: