Skip to content

dirty checking on patch? #35

@yocontra

Description

@yocontra

it seems a little weird that you have to specify which fields go up when you save a model and want to patch only what has changed

Currently this will send the entire model:

model.save(null, {patch: true});

this will send the attributes that changed, but we have to manually specify the keys and values:

model.save({
  fieldOne: 123,
  fieldTwo: 123
}, {patch: true});

which is just as bad as not even using the model

request.patch('/api/users/' + model._id)
  .send({
    fieldOne: 123,
    fieldTwo: 123
  });

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions