How to configure a MongoDB cluster which supports sessions?

前端 未结 6 724
刺人心
刺人心 2020-12-16 17:32

I want to explore the new transaction feature of MongoDB and use Spring Data MongoDB. However, I get the exception message \"Sessions are not supported by the MongoDB cl

6条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-16 17:45

    Make sure you're using the updated API - for example:

    MongoClient mongoClient = MongoClients.create();
    MongoDatabase dataBase = mongoClient.getDatabase("mainDatabase");
    MongoCollection collection = dataBase.getCollection("entities");
    

    Also make sure you have mongo.exe open.

提交回复
热议问题