25 lines
872 B
JavaScript
25 lines
872 B
JavaScript
const mongoose = require('mongoose');
|
|
const path = require('path');
|
|
require('dotenv').config({ path: path.join(__dirname, '..', '.env.local') });
|
|
|
|
async function checkDb() {
|
|
await mongoose.connect(process.env.MONGODB_URI);
|
|
const db = mongoose.connection.db;
|
|
|
|
const apps = await db.collection('app_stats').countDocuments();
|
|
console.log('Apps records:', apps);
|
|
|
|
const protos = await db.collection('protocol_stats').countDocuments();
|
|
console.log('Protocols records:', protos);
|
|
|
|
const countries = await db.collection('country_stats').countDocuments();
|
|
console.log('Country records:', countries);
|
|
|
|
const agents = await db.collection('agent_registry').find().toArray();
|
|
console.log('Agents:', agents.map(a => ({uuid: a.uuid, label: a.label, activated: a.activated, last_seen_at: a.last_seen_at})));
|
|
|
|
process.exit(0);
|
|
}
|
|
|
|
checkDb().catch(console.error);
|