Skip to content

Instantly share code, notes, and snippets.

@mikermcneil
Last active August 29, 2015 14:02
Show Gist options
  • Save mikermcneil/3550c86b72c7c4f58912 to your computer and use it in GitHub Desktop.
Save mikermcneil/3550c86b72c7c4f58912 to your computer and use it in GitHub Desktop.
// Count all records
(function (){async.each(Object.keys(sails.models), function(mi, n) { var m = sails.models[mi]; m.count({}).exec(function(err, c) { if (err) return n(err); console.log('there are ' + c + ' ' + m.identity + ' records.'); }) }, console.log)})()
// Expanded version, for reference
//async.each(Object.keys(sails.models), function(mi, n) {
// var m = sails.models[mi];
// m.count({}).exec(function(err, c) {
// if (err) return n(err);
// console.log('there are ' + c + ' ' + m.identity + ' records.');
// })
//}, console.log)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment