i wonder how to launch mongodb first migration on db container starts?
Have you tried the image description?
When a container is started for the first time it will execute files with extensions
.jsthat are found in
/docker-entrypoint-initdb.d. Files will be executed in alphabetical order.
.jsfiles will be executed by
mongoon versions below 6) using the database specified by the
MONGO_INITDB_DATABASEvariable, if it is present, or
testotherwise. You may also switch databases within the
You probably just need to mount your files into that folder. I don’t use mongodb, but this is similar to how it works in other database servers.