mongoose-attachments-aws2js上传目录

我有一个附件架构:

var mongoose = require('mongoose'); var s3 = require('./config/secrets').s3; var provider = require('mongoose-attachments-aws2js'); var attachments = require('mongoose-attachments'); attachments.registerStorageProvider('aws2js', provider); var attachmentSchema = new mongoose.Schema({ name: String, date_created: {type: Date, default: new Date()}, is_active: {type: Boolean, default: true} }); attachmentSchema.plugin(attachments, { directory: 'HowToChangeThis', storage : { providerName: 'aws2js', options: { key: s3.key, secret: s3.secret, bucket: s3.bucket, acl: 'public-read' } }, properties: { file: { styles: { original: { // keep the original file } } } } }); module.exports = mongoose.model('Attachment', attachmentSchema); 

这个模式用于不同的文档:事件(附件是一个事件图像),用户(附件是一个化身),位置(附件是位置照片)等,但我不想上传所有附件到1个远程目录。 有什么办法可以dynamic更改mongoose-attachments-aws2js目录,并且只保留所有附件的一个模式?