Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-4887

GridFS doesn't support multi-document transactions

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Blocker - P1 Blocker - P1
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      Summary

      The MongoDb Java driver appears to not support multi-document transactions;

      ```

                  _            // _this.getFileObjectService() is my db service that uses a regular collection
                  _            _newId = this.getFileObjectService().add(clientSession, fileObject, interactingEntity);
                  __            
                  GridFSUploadOptions ops = this.getUploadOps(metadata);
                  String filename = newId.toHexString() + "." + FilenameUtils.getExtension(metadata.getOrigName());
                  __            
                  fileObject.setFileName(filename);
                  this.getFileObjectService().update(clientSession, fileObject);
                  __            

      //Throws: Command failed with error 263 (OperationNotSupportedInTransaction): 'Cannot run 'listIndexes' in a multi-document transaction.'
                  bucket.uploadFromStream(clientSession, filename, is, ops);

      ```

      As I am running CRUD operations on regular collections and Gridfs buckets, this error occurs.

      It feels like a hard requirement to preserve an all-or-nothing approach to data processing in case of errors. For me to not have this fixed means I would have to accept potential inconsistencies in my database.

      Please provide the version of the driver. If applicable, please provide the MongoDB server version and topology (standalone, replica set, or sharded cluster).

      `4.8.2`, what is provided in current Quarkus versions

      How to Reproduce

      See above; modifying data in a regular collection and then in a gridfs bucket.

       

      _Determined this was a bug after seeing such posts as https://www.mongodb.com/community/forums/t/gridfs-does-not-support-multi-document-transactions/105984_

            Assignee:
            ashni.mehta@mongodb.com Ashni Mehta
            Reporter:
            contact@gjstewart.net Greg Stewart
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: