@ -2329,8 +2329,10 @@ public class MappingMongoConverter extends AbstractMongoConverter implements App
if ( source instanceof Collection ) {
if ( source instanceof Collection ) {
Class < ? > rawType = typeHint . getType ( ) ;
Class < ? > rawType = typeHint . getType ( ) ;
if ( ! Object . class . equals ( rawType ) ) {
if ( ! Object . class . equals ( rawType ) & & ! String . class . equals ( rawType ) ) {
if ( ! rawType . isArray ( ) & & ! ClassUtils . isAssignable ( Iterable . class , rawType ) ) {
if ( ! rawType . isArray ( ) & & ! ClassUtils . isAssignable ( Iterable . class , rawType ) ) {
throw new MappingException (
throw new MappingException (
String . format ( INCOMPATIBLE_TYPES , source , source . getClass ( ) , rawType , getPath ( ) ) ) ;
String . format ( INCOMPATIBLE_TYPES , source , source . getClass ( ) , rawType , getPath ( ) ) ) ;
}
}
@ -2359,11 +2361,6 @@ public class MappingMongoConverter extends AbstractMongoConverter implements App
return ( S ) dbRefConverter . convert ( context , ( DBRef ) source , typeHint ) ;
return ( S ) dbRefConverter . convert ( context , ( DBRef ) source , typeHint ) ;
}
}
if ( source instanceof Collection ) {
throw new MappingException (
String . format ( INCOMPATIBLE_TYPES , source , BasicDBList . class , typeHint . getType ( ) , getPath ( ) ) ) ;
}
if ( BsonUtils . supportsBson ( source ) ) {
if ( BsonUtils . supportsBson ( source ) ) {
return ( S ) documentConverter . convert ( context , BsonUtils . asBson ( source ) , typeHint ) ;
return ( S ) documentConverter . convert ( context , BsonUtils . asBson ( source ) , typeHint ) ;
}
}