List of usage examples for com.mongodb.client.gridfs.model GridFSUploadOptions metadata
Document metadata
To view the source code for com.mongodb.client.gridfs.model GridFSUploadOptions metadata.
Click Source Link
From source file:io.mandrel.blob.impl.MongoBlobStore.java
License:Apache License
@Override public Uri putBlob(Uri uri, Blob blob) { GridFSUploadOptions options = new GridFSUploadOptions(); Document document = JsonBsonCodec.toBson(mapper, blob.getMetadata()); options.metadata(document); GridFSUploadStream file = bucket.openUploadStream(uri.toString(), options); try {/* w w w . j a v a 2 s.co m*/ IOUtils.copy(blob.getPayload().openStream(), file); } catch (IOException e) { throw Throwables.propagate(e); } file.close(); return Uri.create( "mongodb://" + databaseName + "/" + bucket.getBucketName() + "/" + file.getFileId().toString()); }