Created
May 31, 2023 17:09
-
-
Save vunguyen9404/d9b6a13a90de30c6db7ab40b0c49f217 to your computer and use it in GitHub Desktop.
Wheel Statistics
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| db.getCollection("wheel_histories").aggregate( | |
| [ | |
| { | |
| "$match" : { | |
| } | |
| }, | |
| { | |
| "$group" : { | |
| "_id" : "$createdAtInt", | |
| "totalGem" : { | |
| "$sum" : "$receivedItem.value" | |
| }, | |
| "totalSpin" : { | |
| "$sum" : NumberInt(1) | |
| }, | |
| "users" : { | |
| "$addToSet" : "$user" | |
| } | |
| } | |
| }, | |
| { | |
| "$project" : { | |
| "totalGem" : "$totalGem", | |
| "date" : "$_id", | |
| "totalUser" : { | |
| "$size" : "$users" | |
| }, | |
| "totalSpin" : "$totalSpin" | |
| } | |
| }, | |
| { | |
| "$sort" : { | |
| "date" : NumberInt(1) | |
| } | |
| } | |
| ], | |
| { | |
| "allowDiskUse" : false | |
| } | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment