From 4a9419dbdec80828ea76b77003ac99fb2f87e200 Mon Sep 17 00:00:00 2001 From: Florian Baumann Date: Mon, 28 Nov 2022 17:24:29 +0100 Subject: [PATCH] Cards added per month readme --- readme.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/readme.md b/readme.md index d0d04ef..a4c70c2 100644 --- a/readme.md +++ b/readme.md @@ -174,6 +174,10 @@ Calculate what cards gained most value in percent db.cards.aggregate({$project: {set: 1, collectornumber:1, name: 1, "old": {$arrayElemAt: ["$serra_prices.value", -2]}, "current": {$arrayElemAt: ["$serra_prices.value", -1]} }}, {$match: {old: {$gt: 2}}} ,{$project: {name: 1,set:1,collectornumber:1,current:1, "rate": {$subtract: [{$divide: ["$current", {$divide: ["$old", 100]}]}, 100]} }}, {$sort: { rate: -1}}) +Show when cards where added per month of the year + + db.cards.aggregate({ $project: { month: { $month: "$serra_created" }, year: { $year: "$serra_created" }, name: 1 } }, { $group: { _id: { month: "$month", year: "$year" }, count: { $sum: 1 } } }) + ## MongoDB Operations A few commands that do backups and exports of your data inside of the docker