How to connect backend to a mongodb docker container

From the official docker hub page:

The MongoDB server in the image listens on the standard MongoDB port, 27017, so connecting via Docker networks will be the same as connecting to a remote mongod.

You don't state where you are connecting from and how. If it's another container then you can use the port directly otherwise you need to expose it first.

As for the connection string it's generally from the official docs:

mongo mongodb://$[hostlist]/$[database]?authSource=$[authSource] --username $[username]

You can also use the mongo-express container you used to get the details above or from the docker hub README. So in your case:

mongodb://root:example@mongo:27017/

If your client isn't in a docker container in the same stack you need to expose port 27017 from the first mongodb container:

ports:
    - "27017:27017"