Skip to content
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

fix: m2m sharing same row #3006

Merged
merged 2 commits into from
Jun 27, 2022
Merged

fix: m2m sharing same row #3006

merged 2 commits into from
Jun 27, 2022

Conversation

Weakky
Copy link
Member

@Weakky Weakky commented Jun 23, 2022

Overview

fixes prisma/prisma#12206

@Weakky Weakky added this to the 4.0.0 milestone Jun 23, 2022
Comment on lines -86 to +89
id_map.insert(child_id.coerce_values()?, vec![parent_id.coerce_values()?]);
id_map.insert(child_id, vec![parent_id]);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We inserted the key/value coerced but did the map lookup without coercing so it wouldn't find the entry after the first insert.

@janpio
Copy link
Member

janpio commented Jun 23, 2022

[2022-06-23T16:46:56Z] failures:
[2022-06-23T16:46:56Z]
[2022-06-23T16:46:56Z] ---- queries::simple::m2m::m2m::m2m_sharing_same_row stdout ----
[2022-06-23T16:46:56Z] thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "\u{1b}[1;91merror\u{1b}[0m: \u{1b}[1mError validating field `userId` in model `User`: MongoDB model IDs must have a @map(\"_id\") annotations.\u{1b}[0m\n  \u{1b}[1;94m-->\u{1b}[0m  \u{1b}[4mschema.prisma:14\u{1b}[0m\n\u{1b}[1;94m   | \u{1b}[0m\n\u{1b}[1;94m13 | \u{1b}[0mmodel User {\n\u{1b}[1;94m14 | \u{1b}[0m  \u{1b}[1;91muserId BigInt @id\u{1b}[0m\n\u{1b}[1;94m15 | \u{1b}[0m  tags_ids String[]\n\u{1b}[1;94m   | \u{1b}[0m\n\u{1b}[1;91merror\u{1b}[0m: \u{1b}[1mError validating field `tagId` in model `Tag`: MongoDB model IDs must have a @map(\"_id\") annotations.\u{1b}[0m\n  \u{1b}[1;94m-->\u{1b}[0m  \u{1b}[4mschema.prisma:20\u{1b}[0m\n\u{1b}[1;94m   | \u{1b}[0m\n\u{1b}[1;94m19 | \u{1b}[0mmodel Tag {\n\u{1b}[1;94m20 | \u{1b}[0m  \u{1b}[1;91mtagId String @id @default(uuid())\u{1b}[0m\n\u{1b}[1;94m21 | \u{1b}[0m  name  String\n\u{1b}[1;94m   | \u{1b}[0m\n"', /root/build/migration-engine/qe-setup/src/mongodb.rs:19:66
[2022-06-23T16:46:56Z] stack backtrace:
[2022-06-23T16:46:56Z]    0: rust_begin_unwind
[2022-06-23T16:46:56Z]              at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/std/src/panicking.rs:584:5
[2022-06-23T16:46:56Z]    1: core::panicking::panic_fmt
[2022-06-23T16:46:56Z]              at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/panicking.rs:143:14
[2022-06-23T16:46:56Z]    2: core::result::unwrap_failed

I think the schema needs a special case for the MongoDB id.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

findMany broken with many relations to same entity
3 participants