Skip to content

Instantly share code, notes, and snippets.

@bbengfort
Created June 19, 2014 14:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bbengfort/445a65a373e319819607 to your computer and use it in GitHub Desktop.
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.
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