BasicDBObject objectId = new BasicDBObject("_id", docId);
GridFS gridFS = new GridFS(mongoInstance.getDB(dbName), bucketName);
GridFSDBFile gridFSDBFile = gridFS.findOne(objectId);
String tempDir = System.getProperty("java.io.tmpdir");
tempFile = new File(tempDir + "/" + gridFSDBFile.getFilename());
gridFSDBFile.writeTo(tempFile);
} catch (MongoException m) {
throw new CollectionException(ErrorCodes.GET_COLLECTION_LIST_EXCEPTION, m.getMessage());
} catch (IOException e) {
throw new CollectionException(ErrorCodes.GET_COLLECTION_LIST_EXCEPTION, e.getMessage());