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.

Implement RETURNING on `updateMany`

See original GitHub issue

Hi there. Currently methods like updateOne and findOne takes only unique attributes in the where clause. The problem is, you need not always have a unique/primary key on a record which you want to find.

Its inconvenient since I have to use methods like updateMany when doing this which does not return me the updated records, but just the count. Also due to the fact that composite primary keys are not implemented yet (https://github.com/prisma/photonjs/issues/339) its kind of inconvenient since a single column is many times not unique.

Right now, when using updateMany, I have to do updateMany to first update the records and then a findMany query to get the records leading to 2 queries since when doing updates, you often don’t receive all inputs from users but only specific fields they want to update, but you want all the results as the response post the update.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:61
  • Comments:23 (4 by maintainers)

github_iconTop GitHub Comments

12reactions
GuiSimcommented, Sep 6, 2022

Can we please stick to using the lovely “👍” reaction on the top post instead of posting +1 ? This will be more respectful of those that are subscribed to these issue and wish to be aware of any useful update.

Thank you

9reactions
amirAlamiancommented, Jul 20, 2021

Hi. I need this RETURNING option too.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to updateMany documents and return a list ... - MongoDB
Hi everyone,. I have a list of orders that I want to update but some objects have null values on some parameters.
Read more >
return updated models in mongoose using updateMany?
To return the document with the modifications made on the update, use the new option. What you can do is: Fetch again those...
Read more >
What is updateMany() in Mongoose? - Educative.io
The updateMany() function returns a query which is a write result. The write result contains the number of documents matched, the number of...
Read more >
MongoDB UpdateMany()
The updateMany() method allows you to update all documents that satisfy a condition. ... In this syntax: ... The updateMany() method returns a...
Read more >
MongoDB updateMany() Method - db.Collection.updateMany ...
The updateMany() method updates all the documents in MongoDB collections that match the given query. When you update your document, ...
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