import mongoose from 'mongoose';
import Series from '../server/models/series.js';

const MONGODB_URI = process.env.MONGODB_URI || 'mongodb://localhost:27017/ghostguild';

async function checkSeries() {
  try {
    await mongoose.connect(MONGODB_URI);
    console.log('Connected to MongoDB');

    const allSeries = await Series.find({}).lean();
    console.log(`\nTotal series: ${allSeries.length}\n`);
    allSeries.forEach(s => {
      console.log(`ID: ${s.id}`);
      console.log(`Title: ${s.title}`);
      console.log(`_id: ${s._id}`);
      console.log('---');
    });

  } catch (error) {
    console.error('Error:', error);
  } finally {
    await mongoose.connection.close();
  }
}

checkSeries();
