From 5a3db4b0a224e1c4cf74fd26a1c51cd8da4880ee Mon Sep 17 00:00:00 2001 From: Florian Baumann Date: Tue, 4 Jan 2022 17:11:13 +0100 Subject: [PATCH] mana costs --- src/serra/root.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/serra/root.go b/src/serra/root.go index a5c77d2..fab992d 100644 --- a/src/serra/root.go +++ b/src/serra/root.go @@ -191,8 +191,20 @@ func Stats() { sets, _ := coll.storage_aggregate(groupStage) for _, set := range sets { - // TODO fix primitiveA Problem with loop and reflect fmt.Printf("* %s %d\n", set["_id"], set["count"]) } + + LogMessage(fmt.Sprintf("Mana costs in Collection"), "green") + groupStage = bson.D{ + {"$group", bson.D{ + {"_id", "$manacost"}, + {"count", bson.D{{"$sum", 1}}}, + }}} + m, _ := coll.storage_aggregate(groupStage) + + for _, manacosts := range m { + // TODO fix primitiveA Problem with loop and reflect + fmt.Printf("* %s %d\n", manacosts["_id"], manacosts["count"]) + } }