Uploaded image for project: 'Spark Connector'
  1. Spark Connector
  2. SPARK-291

is there any options in Mongodb Spark connector for filename and the attributes of metadata?

    • Type: Icon: Task Task
    • Resolution: Gone away
    • Priority: Icon: Major - P3 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.

       

            Assignee:
            ross@mongodb.com Ross Lawley
            Reporter:
            bwang2009@yeah.net wang bin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: