When you are unable to login to the unifi controller or forgot admin password, you can restore access using SSH and manipulating mongodb directly.
Do not uninstall unifi controller - most of the data is not stored in mongodb. In case you thought a mongodb backup would be sufficient, you may have fucked up already, just like me. However I managed to write this "tutorial" for anyone to not run into the same trap.