Need help to understand ionDB

I have auth turned on to connect to ionDB

when database is connected, I noticed there is a “users” collection to record user.id, which is nice, but I can do it myself.

My problem is that I do not know when the user is disconnected from ionic app and/or ionDB, say if someone just closes the browser, or phone lost power, etc…

is there a way to delete that user record from users collection once that user is disconnected?

or is there anyway I can find out all connected users?

Also, it would be nice if I could do some cleanup jobs just BEFORE database is going to get disconnected.

A newbie seeks for help