34 lines
1 KiB
JavaScript
34 lines
1 KiB
JavaScript
import mongoose from 'mongoose';
|
|
import Series from '../server/models/series.js';
|
|
import Event from '../server/models/event.js';
|
|
|
|
const MONGODB_URI = process.env.MONGODB_URI || 'mongodb://localhost:27017/ghostguild';
|
|
|
|
async function debug() {
|
|
try {
|
|
await mongoose.connect(MONGODB_URI);
|
|
|
|
const series = await Series.find({}).lean();
|
|
console.log('Series in DB:');
|
|
series.forEach(s => console.log(` ${s.id}: ${s.title}`));
|
|
|
|
console.log('\nAll events with series.id:');
|
|
const allEvents = await Event.find({ 'series.id': { $exists: true } })
|
|
.select('title series.id series.isSeriesEvent')
|
|
.lean();
|
|
|
|
console.log(`Total: ${allEvents.length}`);
|
|
allEvents.forEach(e => {
|
|
console.log(` - ${e.title}`);
|
|
console.log(` series.id: ${e.series?.id}`);
|
|
console.log(` series.isSeriesEvent: ${e.series?.isSeriesEvent}`);
|
|
});
|
|
|
|
} catch (error) {
|
|
console.error('Error:', error);
|
|
} finally {
|
|
await mongoose.connection.close();
|
|
}
|
|
}
|
|
|
|
debug();
|