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
NOT
condition leaks out of its desired bounds
#22007
Comments
Any updates here? Seems like a pretty serious bug to me. I have to be very careful now when using NOT conditions. If I can't rely on the ORM to generate the raw query correctly when using simple conditions, there is no point of using it. If someone could point me to the right sections in the codebase, I would be happy to fix this and open a PR. |
NOT
condition leaks out of its desired bounds
Can confirm the bug on latest |
For mongodb, when we encountered `NOT` filter, we flipped nested condition. However, we did not restore `inverted` flag after we are done processing the filter. So, if there were any subsequent sibling filters after `NOT`, they'll also will be incorrectly inverted. Fix prisma/prisma#22007
For mongodb, when we encountered `NOT` filter, we flipped nested condition. However, we did not restore `inverted` flag after we are done processing the filter. So, if there were any subsequent sibling filters after `NOT`, they'll also will be incorrectly inverted. Fix prisma/prisma#22007
For mongodb, when we encountered `NOT` filter, we flipped nested condition. However, we did not restore `inverted` flag after we are done processing the filter. So, if there were any subsequent sibling filters after `NOT`, they'll also will be incorrectly inverted. Fix prisma/prisma#22007
For mongodb, when we encountered `NOT` filter, we flipped nested condition. However, we did not restore `inverted` flag after we are done processing the filter. So, if there were any subsequent sibling filters after `NOT`, they'll also will be incorrectly inverted. Fix prisma/prisma#22007
Bug description
Consider the following mongodb query:
The aim is to find all videos where either:
However, the query that is passed to mongo db does the following: select all documents where either:
The raw mongo query run by prisma is as follows:
I have noticed that the NOT condition leaks out of its bounds. If I just switch the order of objects inside the OR array, the query works perfectly fine:
How to reproduce
Create a database with the provided schema and load the following data:
Ideally, we should get only the first row, but prisma returns all the rows.
Expected behavior
The query should not put not operator for the title condition.
Prisma information
Environment & setup
Prisma Version
The text was updated successfully, but these errors were encountered: