MCPcopy Index your code
hub / github.com/parse-community/parse-server / cleanupDatabase

Function cleanupDatabase

benchmark/performance.js:80–96  ·  view source on GitHub ↗

* Clean up database between benchmarks

()

Source from the content-addressed store, hash-verified

78 * Clean up database between benchmarks
79 */
80async function cleanupDatabase() {
81 try {
82 if (!mongoClient) {
83 mongoClient = await MongoClient.connect(MONGODB_URI);
84 }
85 const db = mongoClient.db();
86 const collections = await db.listCollections().toArray();
87
88 for (const collection of collections) {
89 if (!collection.name.startsWith('system.')) {
90 await db.collection(collection.name).deleteMany({});
91 }
92 }
93 } catch (error) {
94 throw new Error(`Failed to cleanup database: ${error.message}`);
95 }
96}
97
98/**
99 * Reset Parse SDK to use the default server

Callers 1

runBenchmarksFunction · 0.85

Calls 2

deleteManyMethod · 0.80
connectMethod · 0.45

Tested by

no test coverage detected