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

Operations can indirectly use the wrong codec

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 5.1.0
    • Affects Version/s: None
    • Component/s: Codecs, Command Operations
    • Labels:
      None
    • Java Drivers
    • Not Needed
    • 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?

      JAVA-5304 highlights that when using a Polymorphic MongoCollection type Operations use the instance class to look up the codec from the repository rather than using the MongoCollection document class.

      For example:

      MongoCollection<Pet> collection.insertOne(myDog);
      

      In this case the Operations helper will lookup myDog.class from the codec registry rather than using the MongoCollection document class (Pet.class). This can lead to loss of discriminator information with bson-kotlinx.

            Assignee:
            ross@mongodb.com Ross Lawley
            Reporter:
            ross@mongodb.com Ross Lawley
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: