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

Add `updatedDocs` to delete hook events #263

Closed
mingard opened this Issue May 9, 2017 · 6 comments

Comments

Projects
3 participants
@mingard
Copy link
Member

mingard commented May 9, 2017

When deleting a document, the only parameter that is required is the _id, however the beforeDelete and afterDelete hooks may need access to document data.

In a similar method to the updatedDocs array used in beforeUpdate, append the data argument with the full deleted document.

Thoughts @eduardoboucas?

@eduardoboucas

This comment has been minimized.

Copy link
Member

eduardoboucas commented May 9, 2017

Totally possible. It would involve running an extra query to extract the documents first, but that's what we're doing on the update method anyway.

@mingard

This comment has been minimized.

Copy link
Member Author

mingard commented May 9, 2017

@eduardoboucas great, thank you. If that's okay then, this would be very useful!

@eduardoboucas

This comment has been minimized.

Copy link
Member

eduardoboucas commented May 9, 2017

To confirm, beforeDelete and afterDelete would both receive the same data, which would be the result of a find operation with the query specified. Right?

@mingard

This comment has been minimized.

Copy link
Member Author

mingard commented May 9, 2017

That's exactly it

@jimlambie jimlambie added this to Backlog in API Version 3.0 May 31, 2017

@jimlambie jimlambie modified the milestone: 3.0.0 May 31, 2017

@jimlambie

This comment has been minimized.

Copy link
Member

jimlambie commented Jul 11, 2017

@mingard adding this to a property called deletedDocs .... is that ok for you?

@jimlambie jimlambie moved this from Backlog to In Progress in API Version 3.0 Jul 11, 2017

@mingard

This comment has been minimized.

Copy link
Member Author

mingard commented Jul 11, 2017

@jimlambie ideal, thanks!

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