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

On update, depopulated fields should be repopulated #275

Open
Zertz opened this issue Mar 28, 2016 · 0 comments
Open

On update, depopulated fields should be repopulated #275

Zertz opened this issue Mar 28, 2016 · 0 comments

Comments

@Zertz
Copy link
Collaborator

Zertz commented Mar 28, 2016

Currently,

PATCH /api/Model/id
{
  populated: {
    _id: 'some-id',
    name: 'I am populated!'
  }
}

Returns

{
  populated: 'some-id'
}

The workaround I'm using:

postUpdate: function (req, res, next) {
  req.erm.result.populate('populated').execPopulate().then((result) => {
    req.erm.result = result
    next()
  }).catch(next)
}

Simple enough, but it would be super convenient if fields would automatically populate after being depopulated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant