1

I am developing a social network app, we chose MongoDB as the storage for our app and mongoose as an ORM.
Everything was going smoothly until one dark day the client said he needs to let the users to deactivate their account. Now this seems a simple task but what is making me sick is that the client wants to be like Facebook, so when a user deactivates his account all his data must be hidden somehow and any interaction must be forbidden.
I started by changing all find queries to aggregations with lookup but it is getting really complicated.
Do you suggest I continue in this way or shall I make a bulk update to modify user's posts and comments as inactive so I won't select them when querying when the user deactivates his account?

asked May 13, 2018 at 13:57
2
  • Can you be more explicit in what you mean by "like Facebook." Although we may have an idea what you mean, FB could change their policy in the future, so this question will become confusing. Commented May 14, 2018 at 17:43
  • Not completely irrelevant to the question would be the EU GDPR, article 17. If you want your application to be used, now or in the future, within European Union, you have to be able not only to disable an account, but also delete the user data. In this context, Ewan's answer appears even more valuable. Commented Aug 11, 2018 at 19:35

1 Answer 1

1

I think the simplest way would be to delete the user data from the database entirely.

This would mean that all your current queries were guaranteed not to return the deleted users data and gives a clear separation between what is and isn't 'deleted'.

It could be saved to a archive db or something if the data is required for later use or reactivation.

answered May 13, 2018 at 15:20
2
  • I can't delete them because after the user deactivates his account he can login again any time and he expects his data to be there Commented May 13, 2018 at 19:28
  • restore from the archive db Commented May 13, 2018 at 20:31

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.