mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-30 10:56:53 -05:00
Total managed subscriptions script
This commit is contained in:
parent
7d7513eb3f
commit
fa25d12e67
1 changed files with 22 additions and 0 deletions
|
@ -0,0 +1,22 @@
|
|||
// Print out total managed subscriptions
|
||||
|
||||
// Usage:
|
||||
// mongo <address>:<port>/<database> <script file> -u <username> -p <password>
|
||||
|
||||
var scriptStartTime = new Date();
|
||||
|
||||
var cursor = db.users.find({anonymous: false}, {stripe: 1});
|
||||
var total = 0;
|
||||
while (cursor.hasNext()) {
|
||||
var doc = cursor.next();
|
||||
if (doc.stripe && doc.stripe.recipients) {
|
||||
total += doc.stripe.recipients.length;
|
||||
}
|
||||
}
|
||||
print(total);
|
||||
|
||||
log("Script runtime: " + (new Date() - scriptStartTime));
|
||||
|
||||
function log(str) {
|
||||
print(new Date().toISOString() + " " + str);
|
||||
}
|
Loading…
Reference in a new issue