tractatus/scripts/test-mongodb-connection.js
TheFlow ac2db33732 fix(submissions): restructure Economist package and fix article display
- Create Economist SubmissionTracking package correctly:
  * mainArticle = full blog post content
  * coverLetter = 216-word SIR— letter
  * Links to blog post via blogPostId
- Archive 'Letter to The Economist' from blog posts (it's the cover letter)
- Fix date display on article cards (use published_at)
- Target publication already displaying via blue badge

Database changes:
- Make blogPostId optional in SubmissionTracking model
- Economist package ID: 68fa85ae49d4900e7f2ecd83
- Le Monde package ID: 68fa2abd2e6acd5691932150

Next: Enhanced modal with tabs, validation, export

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-24 08:47:42 +13:00

33 lines
964 B
JavaScript

#!/usr/bin/env node
/**
* Test MongoDB connection
*/
require('dotenv').config();
const mongoose = require('mongoose');
async function testConnection() {
try {
console.log('Connecting to MongoDB...');
await mongoose.connect(process.env.MONGODB_URI || 'mongodb://localhost:27017/tractatus_dev');
console.log('✓ MongoDB connected');
console.log(' Connection state:', mongoose.connection.readyState);
console.log(' Database:', mongoose.connection.name);
console.log(' Host:', mongoose.connection.host);
console.log(' Port:', mongoose.connection.port);
// Test query
const collections = await mongoose.connection.db.listCollections().toArray();
console.log(' Collections:', collections.length);
await mongoose.disconnect();
console.log('✓ Disconnected successfully');
} catch (error) {
console.error('✗ MongoDB connection failed:', error.message);
process.exit(1);
}
}
testConnection();