mongodb java driver: com.mongodb.MongoException: can't find a chunk

时间:2016-02-03 03:12:21

标签: java mongodb

//to download files according to the filename //the arrayList is a list of filename

 try {
   Mongo mongo = new Mongo("10.16.66.107", 27017);

        DB db = mongo.getDB("vt_dbfile");
        for (int i = 0; i < 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 a chunk!  file id: 56aa7a5665cd34935812aae5 chunk: 0
    at com.mongodb.gridfs.GridFSDBFile.getChunk(GridFSDBFile.java:65)
    at com.mongodb.gridfs.GridFSDBFile.writeTo(GridFSDBFile.java:53)
    at com.mongodb.gridfs.GridFSDBFile.writeTo(GridFSDBFile.java:46)
    at com.mongodb.gridfs.GridFSDBFile.writeTo(GridFSDBFile.java:43)
    at com.vt.query.VTDownLoad.vtDownLoad(VTDownLoad.java:21)

0 个答案:

没有答案