* Renames the file with the given _id to the given string * * @param id - the id of the file to rename * @param filename - new name for the file
(id: ObjectId, filename: string, options?: { timeoutMS: number })
| 230 | * @param filename - new name for the file |
| 231 | */ |
| 232 | async rename(id: ObjectId, filename: string, options?: { timeoutMS: number }): Promise<void> { |
| 233 | const filter = { _id: id }; |
| 234 | const update = { $set: { filename } }; |
| 235 | const { matchedCount } = await this.s._filesCollection.updateOne(filter, update, options); |
| 236 | if (matchedCount === 0) { |
| 237 | throw new MongoRuntimeError(`File with id ${id} not found`); |
| 238 | } |
| 239 | } |
| 240 | |
| 241 | /** Removes this bucket's files collection, followed by its chunks collection. */ |
| 242 | async drop(options?: { timeoutMS: number }): Promise<void> { |