MCPcopy
hub / github.com/mongodb/node-mongodb-native / drop

Method drop

src/gridfs/index.ts:242–263  ·  view source on GitHub ↗

Removes this bucket's files collection, followed by its chunks collection.

(options?: { timeoutMS: number })

Source from the content-addressed store, hash-verified

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}

Callers

nothing calls this directly

Calls 2

resolveOptionsFunction · 0.90

Tested by

no test coverage detected