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

Allow discriminators to be used in a collection.

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.6.0
    • Affects Version/s: None
    • Component/s: POJO
    • None

      PR: https://github.com/mongodb/mongo-java-driver/pull/416

      Right now, there is no way to serialize/deserialize a collection of abstract class or interface correctly, even though BsonDiscriminator annotation is added to all relevant classes (i.e. both parent class and all sub-classes). This patch fixes this problem by using the codec of the actual class of the value during encoding instead of the declared class. The decoding already uses a similar process.

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

              Created:
              Updated:
              Resolved: