MCPcopy Create free account
hub / github.com/mikro-orm/mikro-orm / drop

Method drop

packages/mongodb/src/MongoSchemaGenerator.ts:55–69  ·  view source on GitHub ↗
(options: { dropMigrationsTable?: boolean } = {})

Source from the content-addressed store, hash-verified

53 }
54
55 override async drop(options: { dropMigrationsTable?: boolean } = {}): Promise<void> {
56 await this.connection.ensureConnection();
57 const existing = await this.connection.listCollections();
58 const metadata = this.getOrderedMetadata();
59
60 if (options.dropMigrationsTable) {
61 metadata.push({ collection: this.config.get('migrations').tableName } as any);
62 }
63
64 const promises = metadata
65 .filter(meta => existing.includes(meta.collection))
66 .map(meta => this.connection.dropCollection(meta.class));
67
68 await Promise.all(promises);
69 }
70
71 override async update(options: MongoCreateSchemaOptions = {}): Promise<void> {
72 await this.create(options);

Callers 1

refreshMethod · 0.95

Calls 7

listCollectionsMethod · 0.80
getOrderedMetadataMethod · 0.80
pushMethod · 0.80
filterMethod · 0.80
dropCollectionMethod · 0.80
getMethod · 0.65
mapMethod · 0.45

Tested by

no test coverage detected