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

Upsert conditions: fix post-upsert load when conditions no longer match #10

Merged
merged 3 commits into from
May 29, 2017

Conversation

binki
Copy link
Collaborator

@binki binki commented May 29, 2017

When using upsert, you might modify the entity so that it no longer matches the search conditions. The result is that the returned loaded object is null instead of the loaded object. This change fixes that by loading the updated entity using _id instead of conditions.

binki and others added 3 commits May 28, 2017 19:39
Verifies that the upsert option allows performing
and update.
It is possible to use the upsert option to cause the
document to no longer match the search condition.
To retrieve the upserted document, look it up by its
_id instead of querying the search conditions again.
@drudge drudge merged commit fb321dc into drudge:master May 29, 2017
@binki binki deleted the upsert-conditions branch May 29, 2017 16:39
binki added a commit to binki/mongoose-findorcreate that referenced this pull request May 29, 2017
There were some missing closing curly braces and parens
in the test.

The behavior changes in drudge#10 broke the tests for drudge#9. This
update changes the test in drudge#9 to expect the new behavior
from drudge#10.
@binki binki mentioned this pull request May 29, 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.

2 participants