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

Handle exception from find_and_modify with empty collection #29

Closed
wants to merge 1 commit into from

Conversation

bookwyrm
Copy link

@bookwyrm bookwyrm commented Aug 7, 2012

Catch and "handle" the exception that Mongo now returns (and Monped propagates) when you try to find_and_modify on an empty collection.

@ndelage
Copy link

ndelage commented Aug 27, 2012

+1 This fix patch was necessary for me to get delayed_job working with the latest version of mongoid (3.0.5)
and moped (1.2.0). Thanks @bookwyrm

@sferik
Copy link
Collaborator

sferik commented Aug 27, 2012

A few things before we can merge this patch:

  1. If you reference the Moped constant, it should be explicitly required at the top of the file, as well as in the gemspec.
  2. It seems quite brittle to depend on the exact string 'No matching object found'. Are there any guarantees this string won't change in the future? Is there anything more reliable we can check for?
  3. Please include at least two tests with this patch, one for the case where nil is returned and one for when an error is raised.

@sferik sferik force-pushed the master branch 2 times, most recently from bef24ff to fc7910a Compare October 8, 2014 16:40
@dblock
Copy link
Collaborator

dblock commented Feb 13, 2017

I believe this is no longer necessary, but if anyone thinks otherwise please reopen/rebase/write a test.

@dblock dblock closed this Feb 13, 2017
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.

4 participants