import connectDB from '../src/lib/mongodb';
import State from '../src/models/State';

async function check() {
  try {
    const conn = await connectDB();
    console.log('Connected to', conn.connection.host);

    const count = await State.countDocuments();
    console.log('State count:', count);

    const sample = await State.find().limit(5).lean();
    console.log('Sample states:', sample.map(s => s.name));
  } catch (err) {
    console.error('Error checking states:', err);
    process.exit(1);
  } finally {
    process.exit(0);
  }
}

check();
