Created
June 19, 2014 14:47
-
-
Save bbengfort/445a65a373e319819607 to your computer and use it in GitHub Desktop.
Run via mongo cps < counts.js - will extract the active flag issues in Mongo.
This file contains 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
print("Starting analysis of active flag on products count"); | |
print("This may take a little while, please wait ...."); | |
var active = db.products.find({active:true}).count(); | |
var inactive = db.products.find({active:false}).count(); | |
var null_flag = db.products.find({active:null}).count(); | |
var products = db.products.find().count(); | |
var has_flag = db.products.find({active:{$exists:true}}).count(); | |
var no_flag = db.products.find({active:{$exists:false}}).count(); | |
print("There are " + active + " active " + inactive + " inactive " + null_flag + " and null active products"); | |
print("There are " + products + " products, " + has_flag + " with the active flag and " + no_flag + " without."); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment