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

Hard Delete #21

Open
jinxcifer opened this issue May 8, 2018 · 1 comment
Open

Hard Delete #21

jinxcifer opened this issue May 8, 2018 · 1 comment

Comments

@jinxcifer
Copy link

Hi again!

I currently have the situation where I have a user ID and I want to delete that user from the database. I have the following two questions:

  1. To delete the user, I need to do the following:
const user = User.get(_id);
user.remove();

This will result in two database queries, right? Is there another way to do it in just one query, f.e. User.remove(_id);?

  1. When I use

Model.remove(model)

or

Model.prototype.remove()

it only changes the removed flag from false to true. Is there a way to hard delete the user from the database as well?

Thanks in advance!

Best regards,
jinxcifer

@OKNoah
Copy link
Owner

OKNoah commented May 11, 2018

@jinxcifer Welcome back. The _removed field was either created by this project's previous contributor (who we have removed completely and severed all ties), or it's part of ArangoDB. I'm not totally sure, to be honest. The createdAt and updatedAt are also new keys this ORM adds, if you're wondering.

It sounds like we could use a user.hardDelete or user.forceDelete() or user.dangerouslyForceDelete().

If you want to get involved (you don't have to code), you can experiment with how Arango deals with missing records, or whether other ORMs use the _remove field. Telling me this information would save me a lot of time and help implement the change quickly.

Thanks again for your involvement!

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

2 participants