So far the implementation of MappingMongoConverter.findTypeToBeUsed(…) threw an exception if it found a type hind but couldn't load the class. This causes issues when the class names change where the document still contains 'old' type information. Not being able to load a class should simply be considered as no type information found, thus we're returning null now. Updated Javadoc accordingly.
Let recursive mapping calls of collection elements use the value type instead of the collections component type. Refactored MappingMongoConverter to make collection handling more maintainable. Added code to always add custom type information if the actual value being stored differs from the declared one.
Moved some of the DBRef discovering code into implementations of MongoPersistentProperty. Renamed MongoPersistentProperty.getKey() to ….getFieldName().
Several changes to how objects are initialized inside the template:
1. In one is not specified, a MappingMongoConverter is created and set as the default.
2. A special ApplicationEventPublisher implementation is installed by default to handle creating indexes when the template isn't used inside a Spring application context.
3. If a Spring application context is available, it will be set as the template's application context and eventPublisher, with the index creator being registered as an event listener if one isn't already present.
The tests had to be changed in a couple places to accurately reflect how mapping contexts and converters are now handled.
When annotation a repository method with e.g. @Query("{ 'firstname' : ?0, 'lastname' : ?1 }") all placeholders get now replaced correctly. Added unit tests and fixed broken logging in StringBasedQueryCreator,
Removed Criteria.whereId(…). Updated SimpleMongoRepository to use the new method and use more core template methods to prevent objects from being marshalled to find out whether a particular object exists.
Introduced writeSimpleInternal(…) method that automatically stores the name of an enum instead of the enum itself. Changed quite a few places to rather use MongoPersistentProperty.getKey() over getName().
Reding values into a map assumed map keys to be String values. We know leverage the conversion service to convert the key to the type we discover from the generics property information.
User repository interfaces are not required to implement MongoRepository anymore. Added missing override for save(Iterable<? extends T> entities) to return a List<T>.