From e5e1414a9f55487769b9e3a01e263dd0b9d25eeb Mon Sep 17 00:00:00 2001 From: Dongho Kim Date: Wed, 12 Nov 2025 23:13:22 +0100 Subject: [PATCH] update --- check-articles.sh | 49 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 check-articles.sh diff --git a/check-articles.sh b/check-articles.sh new file mode 100644 index 0000000..3e75bc0 --- /dev/null +++ b/check-articles.sh @@ -0,0 +1,49 @@ +#!/bin/bash + +echo "=== Checking Articles by Category ===" +echo "" + +echo "1. Articles from TODAY by category:" +docker exec munich-news-mongodb mongosh -u admin -p changeme --authenticationDatabase admin --quiet --eval ' +var today = new Date(); +today.setHours(0,0,0,0); +db.getSiblingDB("munich_news").articles.aggregate([ + {$match: {created_at: {$gte: today}, summary: {$exists: true, $ne: null}}}, + {$group: {_id: "$category", count: {$sum: 1}}}, + {$sort: {count: -1}} +]) +' + +echo "" +echo "2. ALL articles by category (any date):" +docker exec munich-news-mongodb mongosh -u admin -p changeme --authenticationDatabase admin --quiet --eval ' +db.getSiblingDB("munich_news").articles.aggregate([ + {$match: {summary: {$exists: true, $ne: null}}}, + {$group: {_id: "$category", count: {$sum: 1}}}, + {$sort: {count: -1}} +]) +' + +echo "" +echo "3. Latest article in each category:" +docker exec munich-news-mongodb mongosh -u admin -p changeme --authenticationDatabase admin --quiet --eval ' +db.getSiblingDB("munich_news").articles.aggregate([ + {$match: {summary: {$exists: true, $ne: null}}}, + {$sort: {created_at: -1}}, + {$group: {_id: "$category", latest_article: {$first: "$title"}, latest_date: {$first: "$created_at"}, count: {$sum: 1}}} +]) +' + +echo "" +echo "4. Science articles from TODAY:" +docker exec munich-news-mongodb mongosh -u admin -p changeme --authenticationDatabase admin --quiet --eval ' +var today = new Date(); +today.setHours(0,0,0,0); +db.getSiblingDB("munich_news").articles.find( + {category: "science", created_at: {$gte: today}, summary: {$exists: true}}, + {title: 1, created_at: 1, category: 1, _id: 0} +).sort({created_at: -1}) +' + +echo "" +echo "=== Done ==="