How can I connect localhost on mongodb using docker

Someone can help me with that?

Im trying to create a connection to the mongodb database using docker on linux, but dont know how.
I got this line on my code:

client = await MongoClient.connect(‘mongodb://127.0.0.1:27017’);

but cant run on my browser localhost:3000, becauase the code is waiting this mongodb connection to listen the 3000 port.