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

Patch with ID doesn't work with upsert option #396

Open
gustavohenke opened this issue Dec 20, 2020 · 0 comments
Open

Patch with ID doesn't work with upsert option #396

gustavohenke opened this issue Dec 20, 2020 · 0 comments

Comments

@gustavohenke
Copy link

Steps to reproduce

Have a feathers-mongoose service configured, then try to patch a document whose ID doesn't exist:

app.service('service').patch(id, { some: 'value' }, {
	mongoose: { upsert: true }
});

Expected behavior

It should work just the same as the below:

app.service('service').update(id, { some: 'value' }, {
	mongoose: { upsert: true }
});

Actual behavior

It fails with Not Found error.

Seems to be because passing an ID means that a get will be executed, and it throws.
Unlike not passing an ID, as it will make a find, which doesn't throw when no documents are found.

System configuration

Module versions:

NodeJS version: 12.16.1

Operating System: MacOS

Browser Version: N/A

React Native Version: N/A

Module Loader: N/A

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

No branches or pull requests

1 participant