mongodb java driver:com.mongodb.MongoException: can't find a chunk -
//to download files according filename //the arraylist list of filename
i wondering if there has faced same issue , resolved it.
try { mongo mongo = new mongo("10.16.66.107", 27017); db db = mongo.getdb("vt_dbfile"); (int = 0; < arraylist.size(); i++) { string dbfilename = arraylist.get(i); gridfs gridfs = new gridfs(db, "fs"); gridfsdbfile imageforoutput = gridfs.findone(dbfilename); imageforoutput.writeto("d:\\download_type" +"\\"+ arraylist.get(i)); } } catch (exception e) { // todo: handle exception e.printstacktrace(); }
exception:
com.mongodb.mongoexception: can't find chunk! file id: 56aa7a5665cd34935812aae5 chunk: 0 @ com.mongodb.gridfs.gridfsdbfile.getchunk(gridfsdbfile.java:65) @ com.mongodb.gridfs.gridfsdbfile.writeto(gridfsdbfile.java:53) @ com.mongodb.gridfs.gridfsdbfile.writeto(gridfsdbfile.java:46) @ com.mongodb.gridfs.gridfsdbfile.writeto(gridfsdbfile.java:43) @ com.vt.query.vtdownload.vtdownload(vtdownload.java:21)
Comments
Post a Comment