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

Not capturing delete events. #91

Open
garg10may opened this issue Jan 9, 2022 · 7 comments
Open

Not capturing delete events. #91

garg10may opened this issue Jan 9, 2022 · 7 comments

Comments

@garg10may
Copy link

If I am deleting the original document it's not capturing that. Tried using both 'fine' and 'deleteOne' syntax.

  return await ppc.deleteOne({ _id: id });
  return await ppc.find({ _id: id }).remove();
@vinerich
Copy link
Collaborator

vinerich commented Jan 9, 2022 via email

@vinerich
Copy link
Collaborator

@garg10may We have tests for the findOne syntax. Can you try that and report back?

We didn't register deleteOne currently, since I can't merge right away I won't be able to provide that.

@vinerich
Copy link
Collaborator

Hey @garg10may are there any updates on this?

@garg10may
Copy link
Author

As i understand deleteOne can't be captured since mongodb doesn't provide the same. In other lib also deleteOne is not captured.

@vinerich
Copy link
Collaborator

I tried to get a little into it.

Mongoose doc supports capturing of the deleteOne method. However it is a little tricky to implement correctly since it can be a query or a document hook.

With a little time this could be implemented tho.

What is your opinion on the topic?

@OriaLogic
Copy link

Hi there,

Doing await record.remove() does not seem to save an entry in the change history collection either.
This seems mandatory to me, as I need to know when a record was deleted and by who/what.

Am I mistaken or doing something wrong ?
I can't seem to find a pre('remove') in your code.

This could/should be added quickly WDTY ?

Thanks

@vinerich
Copy link
Collaborator

@OriaLogic this is not related to the deleteOne issue isn't it? I'd move it to a separate issue then.

But coming to your issue, we are talking about this operation right?

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

3 participants