Removes this bucket's files collection, followed by its chunks collection.
(options?: { timeoutMS: number })
| 240 | |
| 241 | /** Removes this bucket's files collection, followed by its chunks collection. */ |
| 242 | async drop(options?: { timeoutMS: number }): Promise<void> { |
| 243 | const { timeoutMS } = resolveOptions(this.s.db, options); |
| 244 | let timeoutContext: CSOTTimeoutContext | undefined = undefined; |
| 245 | |
| 246 | if (timeoutMS) { |
| 247 | timeoutContext = new CSOTTimeoutContext({ |
| 248 | timeoutMS, |
| 249 | serverSelectionTimeoutMS: this.s.db.client.s.options.serverSelectionTimeoutMS |
| 250 | }); |
| 251 | } |
| 252 | |
| 253 | if (timeoutContext) { |
| 254 | await this.s._filesCollection.drop({ timeoutMS: timeoutContext.remainingTimeMS }); |
| 255 | const remainingTimeMS = timeoutContext.getRemainingTimeMSOrThrow( |
| 256 | `Timed out after ${timeoutMS}ms` |
| 257 | ); |
| 258 | await this.s._chunksCollection.drop({ timeoutMS: remainingTimeMS }); |
| 259 | } else { |
| 260 | await this.s._filesCollection.drop(); |
| 261 | await this.s._chunksCollection.drop(); |
| 262 | } |
| 263 | } |
| 264 | } |
nothing calls this directly
no test coverage detected