.add("chunkSize", chunkSize)
.add("uploadDate", new Date(uploadDate));
if (filename != null) builder.add("filename", filename);
if (contentType != null) builder.add("contentType", contentType);
if (metadata != null) builder.add("metadata", JSON.parse(metadata.encode()));
DBObject dbObject = builder.get();
String bucket = jsonObject.getString("bucket", GridFS.DEFAULT_BUCKET);
DBCollection collection = db.getCollection(bucket + ".files");