Files
Deep-Package-Inspection/backend/check_threats.js
T

16 lines
593 B
JavaScript

const mongoose = require('mongoose');
require('dotenv').config({path: '../.env.local'});
mongoose.connect(process.env.MONGODB_URI).then(async () => {
const db = mongoose.connection;
const threats = await db.collection('threats').countDocuments();
const events = await db.collection('events').countDocuments();
const highEvents = await db.collection('events').countDocuments({
$or: [
{severity: {$in: ['Critical', 'High']}},
{category_label: 'Cybersecurity'}
]
});
console.log({threats, events, highEvents});
process.exit(0);
}).catch(e => console.error(e));