Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Mongo .update with query #3363

Copy link
Copy link
@DaddyWarbucks

Description

@DaddyWarbucks
Issue body actions

The update method is currently breaking when using data that affects the query.

For example,

const dave = await app.service('people').create({ name: 'Dave' })

// Now mutate AND query the name property.
const result = await app
  .service('people')
  .update(dave._id, { name: 'Marshal' }, { query: { name: 'Dave' } })

The problem originates here:

return this._findOrGet(id, params).catch(errorHandler)

We have updated the data, but then this following _findOrGet is using the original query. Because our data mutated a value in that query, the request throws a NotFound (even though the record was updated); This likely needs to be handled similarly to patch/remove.

I am currently working on a mongoJoinQuery for a project that will ultimately end up in feathers-fletching. So I am taking a deep dive in the new Mongo adapter. I will eventually create a PR for this problem and any others I stumble across.

Reactions are currently unavailable

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.