require('dotenv').config(); const mongoose = require('mongoose'); async function main() { const mongoUrl = process.env.MONGODB_URI || process.env.MONGO_URL || process.env.MONGO_URI || 'mongodb://localhost:27017/eventbuzz'; await mongoose.connect(mongoUrl, { useNewUrlParser: true, useUnifiedTopology: true }); console.log('Connected to', mongoUrl); const KnowledgeSource = require('../src/models/KnowledgeSource'); const docs = await KnowledgeSource.find({}).sort({ eventId: 1, type: 1 }).lean(); console.log('Total sources:', docs.length); for (const d of docs) { console.log(JSON.stringify({ _id: String(d._id), eventId: String(d.eventId), type: d.type, displayName: d.displayName, status: d.status }, null, 2)); } await mongoose.disconnect(); } main().catch((err) => { console.error('Error', err); process.exit(1); });