Can I connect to MongoDB cluster via Spaces?

I get a timeout error when I try to connect to my MongoDB cluster inside my Streamlit app. The same code works on Colab and my local machine.

Has anyone setup a working connection?

If so, can you point me to documentation or sample code?

Thank you