import mongoose from 'mongoose'; import Event from '../server/models/event.js'; const MONGODB_URI = process.env.MONGODB_URI || 'mongodb://localhost:27017/ghostguild'; async function check() { try { await mongoose.connect(MONGODB_URI); const oldEvent = await Event.findOne({ title: 'Session 0: Orientation' }).lean(); if (oldEvent) { console.log('Found old "Session 0: Orientation" event:'); console.log(` ID: ${oldEvent._id}`); console.log(` series.id: ${oldEvent.series?.id}`); console.log(` series.title: ${oldEvent.series?.title}`); console.log('\nDeleting old event...'); await Event.deleteOne({ _id: oldEvent._id }); console.log('✓ Deleted'); } else { console.log('No old "Session 0: Orientation" event found'); } } catch (error) { console.error('Error:', error); } finally { await mongoose.connection.close(); } } check();