Add MongoCollection<Interface> / MongoCollection<Abstract Class> support by allowing the PojoCodec to detect discriminator support.
Interface:
@BsonDiscriminator public interface Pet { String getType(); } public class Cat implements Pet { private String name; // ... } MongoCollection<Pet>.find() throws: Cannot find a public constructor for 'Pet'. Please ensure the class has a public, empty constructor with no arguments, or else a constructor with a BsonCreator annotation
Abstract classes
@BsonDiscriminator public abstract class Pet { abstract String getType(); } public class Cat extends Pet { private String name; // ... } MongoCollection<Pet>.insertOne(cat) and MongoCollection<Pet>.find() throws: Can't find a codec for CodecCacheKey{clazz=class tour.Pet, types=null}.
These usecases could be supported as the PojoCodec could detect @BsonDiscrim inator support.