Class MongoDBTransaction

java.lang.Object
com.kingsrook.qqq.backend.core.actions.QBackendTransaction
com.kingsrook.qqq.backend.module.mongodb.actions.MongoDBTransaction
All Implemented Interfaces:
AutoCloseable
Direct Known Subclasses:
MongoDBConsistentReadTransaction

public class MongoDBTransaction extends QBackendTransaction
MongoDB implementation of backend transaction. Stores a mongoClient and clientSession. Also keeps track of if the specific mongo backend being used supports transactions, as, it appears that single-node instances do not, and they throw errors if you try to do transaction operations in them... This is configured by the corresponding field in the backend metaData.
  • Constructor Details

    • MongoDBTransaction

      public MongoDBTransaction(MongoDBBackendMetaData backend, com.mongodb.client.MongoClient mongoClient)
    • MongoDBTransaction

      public MongoDBTransaction(MongoDBBackendMetaData backend, com.mongodb.client.MongoClient mongoClient, com.mongodb.client.ClientSession clientSession)
      Adopt the client and its already-open session as one transaction owner.
    • MongoDBTransaction

      protected MongoDBTransaction(MongoDBBackendMetaData backend, com.mongodb.client.MongoClient mongoClient, com.mongodb.client.ClientSession clientSession, boolean allowTransactions)
      As above - but with allowTransactions false, no mongo transaction is started (e.g., for a snapshot-read-concern session, which can't have one), whatever the backend's transactionsSupported says.
  • Method Details