Skip to content

Update/patch (PUT/PATCH) strips "id" from saved object #25

@jfexyz

Description

@jfexyz

I'm still working on a test case, but I'm having issues with the update action. Not sure if it's in this module or another, but here are the details:

  • Using custom id field (id, not _id)
  • PUT /resources/123 with body {"id": "123", "title": "#123"} strips out the id field upon save.

This doesn't help, as it's not honored either; the id field is added to hook.data, but stripped again sometime before saving:

  service
    .before({
      update (hook) {
        // Copy ID from request into object.
        hook.data.id = hook.id
      }
  })

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