Unable to run MongoDb ReplicaSet #1150
-
I have successfully used Ductus.FluentDocker to spin up a mongoDb container with a replica set. This is how I achieved it. Notice it's in 2 steps, first I start the container with the
This will spin up a container, and I can access it with connection string Notice the hostname is
Now the problem is that I would like to achieve the same with TestContainers for MongoDb and I cannot make it work. The following code gets stuck on starting the container
and if I uncomment the entrypoint part, it throws a timeout exception. Has anyone managed to have a replica set working with testcontainers? Ideally a single node replica set, which is the minimum necessary for using change streams. UPDATE: This is the furthest I got, and it fails to initialize the replica set, although the mongoDb container spins up.
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
To add an additional note on this, If I were to spin up a MongoDb replica set using Docker/Docker compose, I would do the following. Run a
Find out the container Id with a And then connect to the container's mongosh
and run the following
so that it is reachable at I would like the same with testcontainer. Has anyone succeeded? PS: I found this StackOverflow question and I added my findings https://stackoverflow.com/a/78277081/2948212 |
Beta Was this translation helpful? Give feedback.
-
Hi 👋 If a module does not support a feature, it is usually a good idea to look into Java's implementation. Some modules offer more features than their .NET counterparts and vice versa. In this case, AFAIK, Java supports replica sets. I think for proper support, it would be good to align the implementation and add the missing pieces from Java to .NET. |
Beta Was this translation helpful? Give feedback.
-
See: Will be included in the next release 3.10.0. |
Beta Was this translation helpful? Give feedback.
See:
Will be included in the next release 3.10.0.