The driver supports the BsonDiscriminator annotation on POJOs, but doesn't do the same for Java records. This makes a certain amount of sense since records are not allowed to extend a base record like a POJO can for a base class. But records can implement common interfaces, so it does still make sense to discriminate between different record types that implement a common interface and are stored in the same collection.
- related to
-
JAVA-5892 Generate Codec instances at runtime for records
-
- Backlog
-