-
Notifications
You must be signed in to change notification settings - Fork 249
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
qe: Fix filter inversion on Mongo's
NOT
filter (#4754)
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
- Loading branch information
Serhii Tatarintsev
authored
Mar 6, 2024
1 parent
4308b70
commit 6795ad9
Showing
3 changed files
with
58 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
query-engine/connector-test-kit-rs/query-engine-tests/tests/new/regressions/prisma_22007.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
use query_engine_tests::*; | ||
|
||
#[test_suite(schema(schema), only(MongoDb))] | ||
mod prisma_2207 { | ||
|
||
fn schema() -> String { | ||
r#" | ||
model Test { | ||
#id(id, Int, @id) | ||
title String | ||
} | ||
"# | ||
.to_owned() | ||
} | ||
#[connector_test] | ||
async fn filters_render_correctly(runner: Runner) -> TestResult<()> { | ||
let query = r#" | ||
mutation { | ||
createManyTest( | ||
data: [ | ||
{id: 1, title: "a"}, | ||
{id: 2, title: "b"}, | ||
{id: 3, title: "c"} | ||
] | ||
) { | ||
count | ||
} | ||
}"#; | ||
insta::assert_snapshot!(run_query!(runner, query), @r###"{"data":{"createManyTest":{"count":3}}}"###); | ||
|
||
let query = r#" | ||
query { | ||
findManyTest( | ||
where: { | ||
OR: [ | ||
{ NOT: { title: "b" } }, | ||
{ title: "c" } | ||
], | ||
} | ||
) { | ||
id | ||
title | ||
} | ||
}"#; | ||
|
||
insta::assert_snapshot!(run_query!(runner, query), @r###"{"data":{"findManyTest":[{"id":1,"title":"a"},{"id":3,"title":"c"}]}}"###); | ||
|
||
Ok(()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters