You can any use env for MONGO_USER and MONGO_PASSWORD. Remove MONGO_DATABASE AND MONGO_CLUSTER in .evn file. Give the Database name and cluster in application properties file. Run the code. It worked for me.