TylerBrock / mongo-hacker

MongoDB Shell Enhancements for Hackers
tylerbrock.github.io/mongo-hacker
MIT License
1.79k stars 235 forks source link

Introducing: the new `count collections` shell helper :-) #135

Closed pvdb closed 9 years ago

pvdb commented 9 years ago

Hey @TylerBrock,

After all the prep work in previous pull requests, here it is - in all its glory - the new count collections shell helper! :smile:

A typical explorative workflow in the mongo shell - which I've captured in the attached screenshot - can now be something along the lines of:

  1. show dbs - to find out which databases exist on the server, incl. an indication of their respective sizes
  2. count collections - to find out how many collections exists in each of these databases
  3. use <database> - to switch to a given database
  4. show collections - to find out which collections exists in this database, incl. an indication of their respective sizes
  5. count documents - to find out how many documents exists in each of these collections

As you can see on the screenshot, I've adopted a color scheme: green for database names, blue for collection names... if you agree that using different colors for databases and collections is a good idea, then please let me know if you prefer different colors... I've made them configurable via config.js so it'd be a doddle to change them!

typical_workflow

TylerBrock commented 9 years ago

Awesome, this is great @pvdb

gianpaj commented 9 years ago

:+1: amazeballs! :laughing:

pvdb commented 9 years ago

amazeballs!

Thanks, @gianpaj ... glad you like it! :smile: