question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add rejectOnNotFound to update

See original GitHub issue

I found this issue that relates to this request, but it is closed (not sure why).

https://github.com/prisma/prisma/issues/5032

I think it makes sense to have rejectOnNotFound on update also, and I think it is very weird that it throws an exception instead of returning null.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:17
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

8reactions
vlad-rzcommented, Apr 22, 2022

Up!

5reactions
SC0d3rcommented, Oct 18, 2022

+1 for this issue, I think it should return null if record doesnt exist.

example:


const updatedUser = await prisma.user.update({
  where: {
    id: userID
  },
  data: {
    /* some changes */
  }
})

if(!updatedUser) { /* handle if update didnt happen */ }
Read more comments on GitHub >

github_iconTop Results From Across the Web

Prisma Client API (Reference)
Use the rejectOnNotFound parameter to configure findUnique and/or ... To perform arithmetic operations on update (add, subtract, multiply, divide), ...
Read more >
How to upgrade to Prisma v4.0.0 - YouTube
In this livestream, the Prisma team walks you through the process of upgrading Prisma to v4.0.0 and gives practical examples of the expected ......
Read more >
How to fix "createMany does not exists..." in prisma?
I'm using createMany to insert multiple data in just a query (see code ... on type 'ProviderDelegate<RejectOnNotFound | RejectPerOperation ...
Read more >
[Community help wanted!] TypeScript Feedback v0.33+
We think its useful to see the change in types, for example, ... I made sure of that, but needs a few lines...
Read more >
prisma nullable schema | The AI Search Engine You Control
after you add our plugin your query will log like this ... deleteMany()` invocation: The change you are trying to make would violate...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found