Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot delete file #418

Open
khoapmd opened this issue May 19, 2022 · 2 comments
Open

Cannot delete file #418

khoapmd opened this issue May 19, 2022 · 2 comments

Comments

@khoapmd
Copy link

khoapmd commented May 19, 2022

delete(id: string): Promise<boolean>
ERROR [ExceptionsHandler] This method requires a valid topology instance

@KosrenDQ
Copy link

KosrenDQ commented Jun 4, 2022

I have the exact same error, only when I use the delete method.

@myesn
Copy link

myesn commented Sep 11, 2022

import { GridFSBucket } from 'mongodb';

private readonly bucket: GridFSBucket;

constructor(@InjectConnection() private readonly connection: Connection) {
  this.bucket = new GridFSBucket(this.connection.db, { bucketName: 'fs' });
}

async delete(id: string) {
  await this.bucket.delete(new mongoose.Types.ObjectId(id));
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants