I cannot connect MongoDB to my application.

I try to set up an AI-Application with a docker-compose up command, the code of this file can be found here:

The problem is that the app cannot connect to MongoDB and I only get this error message all the time:

This is the app.py file:

I tried a few different things like changing the ports or names, but I do not have a lot of knowledge about connecting databases to applications.
I would be very grateful, if someone has an idea what could be the reason or the solution for this problem. If I need to clarify something or provide more context/additional files, just ask.

Thank you for your help!