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

Nested disconnect fails on MongoDB with extendedWhereUnique #16869

Closed
Tracked by #19381 ...
Weakky opened this issue Dec 16, 2022 · 1 comment · Fixed by prisma/prisma-engines#4008
Closed
Tracked by #19381 ...

Nested disconnect fails on MongoDB with extendedWhereUnique #16869

Weakky opened this issue Dec 16, 2022 · 1 comment · Fixed by prisma/prisma-engines#4008
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. team/client Issue for team Client. tech/engines Issue for tech Engines. topic: extendedWhereUnique Preview Feature topic: mongodb topic: previewFeatures Issue touches on an preview feature flag
Milestone

Comments

@Weakky
Copy link
Member

Weakky commented Dec 16, 2022

Bug description

Consider this datamodel

model Parent {
  id Int @id

  childId Int? @unique
  childOpt Child? @relation(fields: [childId], references: [id])
}

model Child {
  id Int @id
  non_unique String
  parentOpt Parent?
}

And say you run this query

await prisma.parent.update({
  where: { id: 1 },
  data: {
    childOpt: { disconnect: { non_unique: 1 } }
  }
})

The query will fail because MongoDB doesn't render the join required to filter on Child.non_unique.

Expected behavior

It looks impossible to perform updates based on filters that require joining foreign collections.
We might need to remove the ability to filter (for disconnect) on MongoDB when the relation field being filtered isn't inlined on the enclosing model.

Environment & setup

  • OS: macOS
  • Database: Postgres 10

Prisma Version

4.7.0
@Weakky Weakky added kind/bug A reported bug. bug/2-confirmed Bug has been reproduced and confirmed. topic: extendedWhereUnique Preview Feature tech/engines Issue for tech Engines. labels Dec 16, 2022
@Weakky Weakky changed the title 1-1 nested disconnect fails on MongoDB with extendedWhereUnique nested disconnect fails on MongoDB with extendedWhereUnique Dec 16, 2022
@Weakky
Copy link
Member Author

Weakky commented Dec 16, 2022

Related to #15837

@Weakky Weakky changed the title nested disconnect fails on MongoDB with extendedWhereUnique Nested disconnect fails on MongoDB with extendedWhereUnique Dec 16, 2022
@janpio janpio added the team/client Issue for team Client. label Dec 16, 2022
@Jolg42 Jolg42 added the topic: previewFeatures Issue touches on an preview feature flag label May 31, 2023
@Jolg42 Jolg42 added this to the 4.16.0 milestone May 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. team/client Issue for team Client. tech/engines Issue for tech Engines. topic: extendedWhereUnique Preview Feature topic: mongodb topic: previewFeatures Issue touches on an preview feature flag
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants