Uploaded image for project: 'Drivers'
  1. Drivers
  2. DRIVERS-656

Change Transactions Examples to not drop database

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Component/s: None
    • Labels:
      None
    • $i18n.getText("admin.common.words.hide")
      Key Status/Resolution FixVersion
      SWIFT-551 Done
      $i18n.getText("admin.common.words.show")
      #scriptField, #scriptField *{ border: 1px solid black; } #scriptField{ border-collapse: collapse; } #scriptField td { text-align: center; /* Center-align text in table cells */ } #scriptField td.key { text-align: left; /* Left-align text in the Key column */ } #scriptField a { text-decoration: none; /* Remove underlines from links */ border: none; /* Remove border from links */ } /* Add green background color to cells with FixVersion */ #scriptField td.hasFixVersion { background-color: #00FF00; /* Green color code */ } /* Center-align the first row headers */ #scriptField th { text-align: center; } Key Status/Resolution FixVersion SWIFT-551 Done

      In sharding, dropping the database does not go through database versioning. So if you have more than 1 mongos and are round robining requests (in the way all drivers do) any mongos that did not explicitly send the drop or create will not discover that the database exists, thus sending incorrect results. For example after inserting data and then performing a count, you'll see the count is 0. See this ticket for details: HELP-9914

      We're working on potential solutions on the server-side, but I want to update all the transactions examples that we'd like to reference in the general public beta.

      I do not believe the node examples have this issue: https://gist.github.com/mbroadst/2a719a7adeb8b0476f50ac5643d70166

      Python does: https://github.com/mongodb/mongo-python-driver/blob/3.7.0b0/test/test_examples.py#L849

      Java also does: https://gist.github.com/jyemin/7031cc235759e4619ab0ab342f22db37#file-betaexamples-java-L53

      Changing Java to the below works

             database = client.getDatabase("test");
              // create the collections in advance so there is no attempt to implicitly create them within the transaction
              database.createCollection("inventory");
              database.createCollection("shipment");
      
              inventory = database.getCollection("inventory");
              shipment = database.getCollection("shipment");
      
              inventory.deleteMany(new Document());
              shipment.deleteMany(new Document());
      
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            alyson.cabral@mongodb.com Alyson Cabral (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: