BsonDiscriminator key not populated on reads

XMLWordPrintableJSON

    • Type: Question
    • Resolution: Gone away
    • Priority: Unknown
    • None
    • Affects Version/s: None
    • Component/s: POJO
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • 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 Lawley
              Reporter:
              Darren Matthews
              None
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: