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

BsonDiscriminator key not populated on reads

    • Type: Icon: Question Question
    • Resolution: Gone away
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: POJO
    • None

      Summary

      When reading a POJO that has been inserted using the BsonDiscriminator annotation the object maps correctly to the java object but the key value is not populated in the object. In the extended class I would have expected at least the 'value' part of the annotation would have populated the key field with the value.

       

      Server Version : 5.0.15

      Driver Version: mongodb-driver-sync @ 4.9.0

       

      @BsonDiscriminator(key = "type")
      public abstract class Action {
          ActionType type;
      } 
      @BsonDiscriminator(key = "type", value = "SHOT") 
      public class Shot extends Action {
      // Some other fields that successfully populate
      }
      

            Assignee:
            ross@mongodb.com Ross Lawley
            Reporter:
            darrenmatthews776@googlemail.com Darren Matthews
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: