I’m attempting to store an object in a MongoDB database (using MongoDB 3.12.6) and am getting following error:
“org.bson.codecs.configuration.CodecConfigurationException: An exception occurred when encoding using the AutomaticPojoCodec.”
I am using the following lines of code currently to create CodeRegistry:
CodecRegistry codecRegistry = CodecRegistries.fromRegistries( MongoClientSettings.getDefaultCodecRegistry(), CodecRegistries.fromProviders(PojoCodecProvider.builder().automatic(true).build()));
But for some reason AutomaticPojoCodec generated here does not seem to work to encode/decode POJO.
Anyone could please suggest on this ?