27 lines
692 B
JavaScript
27 lines
692 B
JavaScript
import mongoose from 'mongoose';
|
|
import Event from '../server/models/event.js';
|
|
import dotenv from 'dotenv';
|
|
|
|
dotenv.config();
|
|
const MONGODB_URI = process.env.NUXT_MONGODB_URI || process.env.MONGODB_URI;
|
|
|
|
async function cleanup() {
|
|
try {
|
|
await mongoose.connect(MONGODB_URI);
|
|
|
|
// Delete the old Session 0 event (the one without a position)
|
|
const result = await Event.deleteOne({
|
|
title: 'Session 0: Orientation',
|
|
'series.position': { $exists: false }
|
|
});
|
|
|
|
console.log(`✓ Deleted ${result.deletedCount} old event(s)`);
|
|
|
|
} catch (error) {
|
|
console.error('Error:', error);
|
|
} finally {
|
|
await mongoose.connection.close();
|
|
}
|
|
}
|
|
|
|
cleanup();
|