There is not any issue with my mongo database as im using it with live applications, this occurs only with the node-red docker image, when i run locally it is working properly, so there is something missing with the docker image.
I was thinking this forum could help with some valuable and serious ideas. Not just to recommend google it.
Is your mongo server allowing incoming traffic through (outgoing) docker containers? Say you were to get a shell into your running docker container, then call it manually. Does it run? If yes it might be a node-red issue. If no it might be a docker/mongo issue.
You never mentioned docker in your original post so how are we to guess ? but yes - unless you have specifically opened up the necessary ports for mongo on your docker instance then the Node-RED mongo node won't be able to get out to make a connection.