public async Task<ObjectId> UploadFromStreamAsync(string gfsname, Stream source,string filename, MediaTypeEnum bucketName) { var bucket = new GridFSBucket(_db, new GridFSBucketOptions { BucketName = bucketName.ToString() }); var options = new GridFSUploadOptions { Metadata = new BsonDocument { { "filename", filename }, { "contentType", MimeMapping.GetMimeMapping(filename) } } }; return await bucket.UploadFromStreamAsync(gfsname, source, options); }
public async Task<ObjectId> SaveBigFire(string fileName, Stream fireStream) { var bucket = new GridFSBucket(Client.GetDatabase(BigDataFireDBName)); return await bucket.UploadFromStreamAsync(fileName, fireStream); }