Skip to content

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

Open
@gustavohenke

Description

@gustavohenke

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:

  • mongoose@5.11.1
  • feathers-mongoose@8.3.1

NodeJS version: 12.16.1

Operating System: MacOS

Browser Version: N/A

React Native Version: N/A

Module Loader: N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions