What are the best practices to auto configure mongo DB while installing helm chart

Our application is provided as helm chart and mongoDB community is a sub chart in this

Please suggest best practices to automatically create roles, users, shard a collection, create collections and enable authentication

I want to perform all the above operations through helm chart configuration or some approach
I dont want to manually do them - currently I have a service and we call the service to configure mongoDb when all mongo pods are in running status and restart mongo pods with keyFile = True to enable authentication

I feel the current way reduces too much of manual effort still I feel its not optimal - please guide