@payloadcms/db-mongodb
Advanced tools
Comparing version
@@ -27,2 +27,3 @@ import mongoose from 'mongoose'; | ||
if (this.mongoMemoryServer) { | ||
this.payload.logger.info('Waiting for MongoDB Memory Server replica set to elect a primary...'); | ||
await new Promise((resolve)=>setTimeout(resolve, 2000)); | ||
@@ -35,3 +36,3 @@ } | ||
} | ||
if (!this.mongoMemoryServer && !hotReload) { | ||
if (!hotReload) { | ||
if (process.env.PAYLOAD_DROP_DATABASE === 'true') { | ||
@@ -38,0 +39,0 @@ this.payload.logger.info('---- DROPPING DATABASE ----'); |
import mongoose from 'mongoose'; | ||
export const destroy = async function destroy() { | ||
if (this.mongoMemoryServer) { | ||
await this.mongoMemoryServer.stop(); | ||
} else { | ||
await mongoose.disconnect(); | ||
} | ||
await mongoose.disconnect(); | ||
Object.keys(mongoose.models).map((model)=>mongoose.deleteModel(model)); | ||
@@ -9,0 +5,0 @@ }; |
{ | ||
"name": "@payloadcms/db-mongodb", | ||
"version": "3.41.0-canary.3", | ||
"version": "3.41.0-canary.4", | ||
"description": "The officially supported MongoDB database adapter for Payload", | ||
@@ -20,4 +20,4 @@ "homepage": "https://payloadcms.com", | ||
], | ||
"sideEffects": false, | ||
"type": "module", | ||
"sideEffects": false, | ||
"exports": { | ||
@@ -52,8 +52,8 @@ ".": { | ||
"mongodb": "6.12.0", | ||
"mongodb-memory-server": "^10", | ||
"mongodb-memory-server": "10.1.4", | ||
"@payloadcms/eslint-config": "3.28.0", | ||
"payload": "3.41.0-canary.3" | ||
"payload": "3.41.0-canary.4" | ||
}, | ||
"peerDependencies": { | ||
"payload": "3.41.0-canary.3" | ||
"payload": "3.41.0-canary.4" | ||
}, | ||
@@ -60,0 +60,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
628229
-0.02%6566
-0.05%