@mikro-orm/mongodb
Advanced tools
@@ -7,6 +7,6 @@ import { AbstractSchemaGenerator, Utils, } from '@mikro-orm/core'; | ||
async createSchema(options = {}) { | ||
await this.connection.ensureConnection(); | ||
options.ensureIndexes ??= true; | ||
const existing = await this.connection.listCollections(); | ||
const metadata = this.getOrderedMetadata(); | ||
metadata.push({ collection: this.config.get('migrations').tableName }); | ||
/* v8 ignore start */ | ||
@@ -29,5 +29,4 @@ const promises = metadata | ||
async dropSchema(options = {}) { | ||
const db = this.connection.getDb(); | ||
const collections = await db.listCollections().toArray(); | ||
const existing = collections.map(c => c.name); | ||
await this.connection.ensureConnection(); | ||
const existing = await this.connection.listCollections(); | ||
const metadata = this.getOrderedMetadata(); | ||
@@ -54,2 +53,3 @@ if (options.dropMigrationsTable) { | ||
async dropIndexes(options) { | ||
await this.connection.ensureConnection(); | ||
const db = this.connection.getDb(); | ||
@@ -74,2 +74,3 @@ const collections = await db.listCollections().toArray(); | ||
async ensureIndexes(options = {}) { | ||
await this.connection.ensureConnection(); | ||
options.ensureCollections ??= true; | ||
@@ -76,0 +77,0 @@ options.retryLimit ??= 3; |
{ | ||
"name": "@mikro-orm/mongodb", | ||
"type": "module", | ||
"version": "7.0.0-dev.8", | ||
"version": "7.0.0-dev.9", | ||
"description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.", | ||
@@ -53,10 +53,10 @@ "exports": { | ||
"dependencies": { | ||
"mongodb": "6.14.2" | ||
"mongodb": "6.15.0" | ||
}, | ||
"devDependencies": { | ||
"@mikro-orm/core": "^6.4.9" | ||
"@mikro-orm/core": "^6.4.13" | ||
}, | ||
"peerDependencies": { | ||
"@mikro-orm/core": "7.0.0-dev.8" | ||
"@mikro-orm/core": "7.0.0-dev.9" | ||
} | ||
} |
75945
0.03%1263
0.08%