Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function createBucket(optns = {}) {
// ensure options
let { connection } = optns;
connection = (connection || mongoose.connection);
const options =
_.merge({}, DEFAULT_BUCKET_OPTIONS, _.omit(optns, 'connection'));
// create GridFSBucket
const db = connection.db;
const bucket = new GridFSBucket(db, options);
// return bucket
return bucket;
}