This commit is contained in:
2025-11-12 23:13:22 +01:00
parent 45df834d5b
commit e5e1414a9f

49
check-articles.sh Normal file
View File

@@ -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 ==="