@@ -0,0 +1,1532 @@
+package ch.rasc.eds.starter.config;%0A%0Aimport java.util.List;%0A%0Aimport org.bson.BsonReader;%0Aimport org.bson.BsonWriter;%0Aimport org.bson.codecs.Codec;%0Aimport org.bson.codecs.DecoderContext;%0Aimport org.bson.codecs.EncoderContext;%0Aimport org.bson.codecs.configuration.CodecProvider;%0Aimport org.bson.codecs.configuration.CodecRegistry;%0A%0A@SuppressWarnings(%7B %22unchecked%22, %22rawtypes%22 %7D)%0Apublic final class ListCodec implements Codec%3CList%3E %7B%0A%09private final CodecRegistry codecRegistry;%0A%0A%09public static class Provider implements CodecProvider %7B%0A%0A%09%09@Override%0A%09%09public %3CT%3E Codec%3CT%3E get(Class%3CT%3E clazz, CodecRegistry registry) %7B%0A%09%09%09if (List.class.isAssignableFrom(clazz)) %7B%0A%09%09%09%09return (Codec%3CT%3E) new ListCodec(registry);%0A%09%09%09%7D%0A%09%09%09return null;%0A%09%09%7D%0A%09%7D%0A%0A%09public ListCodec(CodecRegistry codecRegistry) %7B%0A%09%09this.codecRegistry = codecRegistry;%0A%09%7D%0A%0A%09@Override%0A%09public void encode(BsonWriter writer, List value, EncoderContext encoderContext) %7B%0A%09%09if (value != null && !value.isEmpty()) %7B%0A%09%09%09writer.writeStartArray();%0A%09%09%09for (Object a : value) %7B%0A%09%09%09%09if (a != null) %7B%0A%09%09%09%09%09Codec codec = this.codecRegistry.get(a.getClass());%0A%09%09%09%09%09encoderContext.encodeWithChildContext(codec, writer, a);%0A%09%09%09%09%7D%0A%09%09%09%09else %7B%0A%09%09%09%09%09writer.writeNull();%0A%09%09%09%09%7D%0A%09%09%09%7D%0A%09%09%09writer.writeEndArray();%0A%09%09%7D%0A%09%09else %7B%0A%09%09%09writer.writeNull();%0A%09%09%7D%0A%09%7D%0A%0A%09@Override%0A%09public List decode(BsonReader reader, DecoderContext decoderContext) %7B%0A%09%09throw new UnsupportedOperationException(%22this codec is only used for encoding%22);%0A%09%7D%0A%0A%09@Override%0A%09public Class%3CList%3E getEncoderClass() %7B%0A%09%09return List.class;%0A%09%7D%0A%7D%0A

Refactor updating user. Use updateOne instead of replaceOne