You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
After updating mongodb and mongoose packages, when I try to create new GridFsStorageInstance, this error appears: Type 'Db' is not assignable to type 'DbTypes | Promise<DbTypes>'.
The full class is:
import { Injectable } from '@nestjs/common';
import { InjectConnection } from '@nestjs/mongoose';
import {
MulterModuleOptions,
MulterOptionsFactory,
} from '@nestjs/platform-express';
import { Connection } from 'mongoose';
import { GridFsStorage } from 'multer-gridfs-storage/lib/gridfs';
@Injectable()
export class GridFsMulterConfigService implements MulterOptionsFactory {
private gridFsStorage: GridFsStorage;
public constructor(@InjectConnection() private connection: Connection) {
this.gridFsStorage = new GridFsStorage({
db: this.connection.db, // Type 'Db' is not assignable to type 'DbTypes | Promise<DbTypes>
file: async (_, file) => {
return new Promise(async (resolve) => {
const filename = file.originalname.trim();
const fileInfo = {
filename,
};
resolve(fileInfo);
});
},
});
}
public createMulterOptions(): MulterModuleOptions {
return {
storage: this.gridFsStorage,
};
}
}
Environment
I'm using multer-gridfs-storage version 5.0.2
My installed MongoDb version is 4.12.0
I have Multer 1.4.5-lts.1 installed to upload files
The Node version used to run the code is 16.16.0
I'm (using/not using) Mongoose connection objects to create storage instances. The Mongoose version installed is (major.minor.patch)
The text was updated successfully, but these errors were encountered:
Describe the bug
After updating mongodb and mongoose packages, when I try to create new GridFsStorageInstance, this error appears:
Type 'Db' is not assignable to type 'DbTypes | Promise<DbTypes>'.
The full class is:
Environment
I'm using
multer-gridfs-storage
version 5.0.2My installed MongoDb version is 4.12.0
I have Multer 1.4.5-lts.1 installed to upload files
The Node version used to run the code is 16.16.0
The text was updated successfully, but these errors were encountered: