Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-12709

Java transaction example is incorrect

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • Server_Docs_20231030
    • None
    • manual
    • None

    Description

      Description

      On https://docs.mongodb.com/master/core/transactions/#transactions-in-applications, in the Java tab, the code sample is wrong.

      Insead of

              coll1.insertOne(new Document("abc", 1));
              coll2.insertOne(new Document("xyz", 999));
      

      it should be

              coll1.insertOne(clientSession, new Document("abc", 1));
              coll2.insertOne(clientSession , new Document("xyz", 999));
      

      I'm not sure where the source for this code lives. I thought it would be in the Java driver repository, but I don't see it there.

      Thanks to shane.harvey for spotting this.

      Scope of changes

      Impact to Other Docs

      MVP (Work and Date)

      Resources (Scope or Design Docs, Invision, etc.)

      Attachments

        Activity

          People

            kay.kim@mongodb.com Kay Kim (Inactive)
            jeff.yemin@mongodb.com Jeffrey Yemin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              4 years, 38 weeks, 5 days ago