#!/usr/bin/env node require('dotenv').config(); const mongoose = require('mongoose'); const Document = require('../src/models/Document.model'); (async () => { await mongoose.connect('mongodb://localhost:27017/tractatus_dev'); const doc = await Document.findBySlug('introduction'); console.log('English sections:', doc.sections ? doc.sections.length : 0); console.log('Has German translation:', !!doc.translations?.de); console.log('German translation fields:', Object.keys(doc.translations?.de || {})); console.log('German has sections in translation:', !!doc.translations?.de?.sections); if (doc.sections && doc.sections[0]) { console.log('\nFirst English section title:', doc.sections[0].title); } if (doc.translations?.de?.sections && doc.translations.de.sections[0]) { console.log('First German section title:', doc.translations.de.sections[0].title); } else { console.log('German translation does NOT have sections field'); } await mongoose.disconnect(); })().catch(console.error);