Get all users from database

hey all is there a function/way to interact with the database at large. I would like to run functions on the entire user list ( check balances of each user and add certain ones to arrrays etc). Is there a way to do this from Javascript ? Or do I need to do this in moralis?

I didn’t completely understand the question, you can connect directly to mongo db if you want, or you can use a cloud function with master key to access any data from db.