-
Type: Task
-
Resolution: Gone away
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Labels:None
Writing mongos by gridfs method can configure the attributes of metadata and filename by the Interface 'GridFSUploadStream openUploadStream(String filename, GridFSUploadOptions options)'. As following example:
public class HandleModel { private static GridFSBucket gridFSBucket; public static void putModel(Object model, String objName) throws Exception { String uuid = UUID.randomUUID().toString(); ByteArrayOutputStream btos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(btos); oos.writeObject(model); oos.flush(); oos.close(); byte[] fileContent = btos.toByteArray(); btos.close(); GridFSUploadOptions options = new GridFSUploadOptions().chunkSizeBytes(3584000).metadata(new Document("objectType", objName)); GridFSUploadStream uploadStream = gridFSBucket.openUploadStream(uuid, options); uploadStream.write(fileContent); uploadStream.close(); } }
is there any options in Mongodb Spark connector for filename and the attributes of metadata?
Thanks.