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

Mongodb java driver findOneAndUpdate method doesn't return the updated document after executing update Query

    • Type: Icon: Question Question
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 4.9.0
    • Component/s: Query Operations
    • Labels:
      None
    • Java Drivers
    • 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

      In Java, the mongodb-driver-sync jar, findOneAndUpdate method doesn't return the updated document after executing the update query, when we set FindOneAndUpdateOptions with ReturnDocument.AFTER

      Please find the details below:

      • version of the driver - mongodb-driver-sync version 4.9.0
      • MongoDB server version - 6
      • topology - replica set.

      How to Reproduce

      1. Please run the MongoDB 6 server in replica set mode.
      2. use jar mongodb-driver-sync version 4.9.0 as dependencies in your java project.
      3. Write java code to execute update query using findOneAndUpdate method with FindOneAndUpdateOptions -  ReturnDocument.AFTER

      Thanks.

            Assignee:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Reporter:
            gobinath@rfpio.com Gobinath N
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: