1.报错信息为:org.bson.codecs.configuration.CodecConfigurationException: Can’t find a codec for class [Ljava.lang.String;
原因是mongodb中的insertMany()方法必须对应BSON数据,因此在Document类现在暂时只支持添加List,不支持java数组
将
Document document = new Document();
document.put("test", new String[0]);
改为
Document document = new Document();
document.put("test", new LinkedList<String>());
后,就没有出现这个问题了.