Embedded Mongo : Session not supported by Mongo Cluster Issue

611 Views Asked by At

I am working on unit testing using embedded mongo. It is able to connect to mongo at the random port but on running the test I am getting error of - com.mongodb.MongoClientException: Sessions are not supported by the MongoDB cluster to which this client is connected

1

There are 1 best solutions below

0
Tom Weasley On

I think the issue is that you are testing mongo transactions on a standalone mongo instance. Mongo supports transactions only for a replica set since the transactions depend on the existence of the oplog. So for your unit tests you need to deploy replica set. Note that there is no need to deploy replica set with 3 nodes, 1 node is enough.