const mongoose = require('mongoose'); async function testFilter() { await mongoose.connect('mongodb://backone_inspect:backone_inspect@mongodb.prod.proit.id:27017/backone_inspect_0'); console.log("Connected to MongoDB."); const kantorUUID = 'F6-2V-DT-8A'; // 1. Check devices specifically tagged with Kantor's UUID const kantorDevices = await mongoose.connection.collection('device_stats').find({ agent_uuid: kantorUUID }).toArray(); console.log(`\nTotal device records saved in Database specifically for Agent Kantor (${kantorUUID}): ${kantorDevices.length}`); // 2. See if any of these explicitly-tagged Kantor records have Balaraja's IP (10.6.x.x) const contaminated = kantorDevices.filter(d => d.ip_address && d.ip_address.startsWith('10.6.')); console.log(`\nOUT OF THOSE, how many have Balaraja IP (10.6.x.x) despite being tagged as Kantor? ${contaminated.length}`); if (contaminated.length > 0) { console.log("Example contaminated IPs in DB under Kantor's UUID:"); console.log(contaminated.slice(0, 5).map(d => `- ${d.ip_address}`).join('\n')); } process.exit(0); } testFilter();