#!/usr/bin/env node /** * Verify All 34 Public Documents * * Lists all 34 documents that should be visible on the frontend */ require('dotenv').config(); const { MongoClient } = require('mongodb'); async function verify34Documents() { const client = new MongoClient('mongodb://localhost:27017'); try { await client.connect(); const db = client.db('tractatus_dev'); const collection = db.collection('documents'); // Get documents with proper categories (not 'none') const documents = await collection.find({ visibility: { $in: ['public', 'archived'] }, category: { $in: ['getting-started', 'technical-reference', 'research-theory', 'advanced-topics', 'case-studies', 'business-leadership', 'archives'] } }) .sort({ category: 1, order: 1 }) .toArray(); console.log(`\n=== VERIFICATION: 34 Public Documents ===`); console.log(`Found: ${documents.length} documents\n`); const byCategory = {}; documents.forEach(doc => { const cat = doc.category; if (!byCategory[cat]) { byCategory[cat] = []; } byCategory[cat].push({ order: doc.order, title: doc.title, slug: doc.slug, visibility: doc.visibility || 'public', sections: doc.sections ? doc.sections.length : 0 }); }); Object.keys(byCategory).sort().forEach(category => { console.log(`\n━━━ ${category.toUpperCase()} (${byCategory[category].length} docs) ━━━`); byCategory[category].forEach(doc => { const sectionStatus = doc.sections > 0 ? `✅ ${doc.sections} sections` : `❌ No sections`; console.log(`${doc.order}. ${doc.title}`); console.log(` ${doc.slug} | ${doc.visibility} | ${sectionStatus}`); }); }); console.log(`\n═══════════════════════════════════════════════════`); console.log(`Total: ${documents.length} documents`); await client.close(); } catch (error) { console.error('Error:', error); } } verify34Documents();