spring data mongodb 操作保存時為什麼一直出現com.mongodb.MongoException: couldn't save chunks異常
代碼如下 :
public GridFSFile upload(InputStream inputStream,String fileName,String fileType){
Assert.notNull(inputStream,"輸入流不能為空!");
Assert.notNull(fileName,"文件不能為空!");
Assert.notNull(inputStream,"輸入流不能為空!");
ApplicationContext ctx = new AnnotationConfigApplicationContext(SpringMongoConfig.class);
gridOperations = (GridFsOperations) ctx.getBean("gridFsTemplate");
GridFSFile gridfs = gridOperations.store(inputStream, fileName,fileType);
return gridfs;
}
參考:https://groups.google.com/d/topic/mongodb-user/tcxEmdBNz5g