}
GridFS gridFS = new GridFS(mongoInstance.getDB(dbName), bucketName);
GridFSInputFile fsInputFile = gridFS.createFile(inputStream, fileData.getFileName());
fsInputFile.setContentType(formData.getMediaType().toString());
fsInputFile.save();
String objectId = JSON.serialize(fsInputFile.getId());
JSONObject obj = new JSONObject();
obj.put("name", fsInputFile.getFilename());
obj.put("size", fsInputFile.getLength());
obj.put("url", String.format("services/%s/%s/gridfs/getfile?id=%s&download=%s&connectionId=%s&ts=%s", dbName, bucketName, objectId, false, connectionId, new Date()));