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?

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Gone away
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      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.

       

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: