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.

How to get a count of modified documents via update

See original GitHub issue

For example we have a code:

DB.Update<Profile>()
  .Match(a => a.Nick== nick && a.Money >= 10)
  .Modify(b => b.Inc(a => a.Money , -10))
  .Modify(b => b.CurrentDate(a => a.ModifiedOn))
  .Execute();

How can we understand was it applied or not? Can we get a count of modified documents?

PS. Thanks for the library.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
dj-nitehawkcommented, Mar 17, 2020

@rzer just released v11.8. all save/update/delete endpoints now return results where you can get the stats you wanted like in official driver.

@paolobriones thanks for the vote of confidence buddy!

1reaction
rzercommented, Mar 17, 2020

Thanks!

I found that your library is the great wrapper for standart MongoDB driver. It’s only one barrier for me now to use it in my project. This functionality will be very helpfull for me. I really appreciate your work!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to count how many sub-documents have been ...
You can use findOneAndUpdate which can return the updated document (or a projection) - possibly this can be used to determine the change...
Read more >
Getting to count of documents where modified older than ...
You can use a CAML query to get the count of documents. You can use PowerShell to get all the files not modified...
Read more >
Count of records when using modify statement
Hi All , when i am using the modify statement to modify the custom table , i need to know how many records...
Read more >
Why Matchedcount is different than Modified Count in ...
I have tried collection.bulk_write(bulkset) for insert, update as well as delete operations. But, matchcount and modifiedcount / insertcount ...
Read more >
db.collection.update()
By default, the db.collection.update() method updates a single document. Include the option multi: true to update all documents that match the query criteria....
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