BlogUse following script and command to quickly get the number of records/rows in the collections/tables in a database.
mongo-ls.js script:
1var collections = db.getCollectionNames(); 2for (var i = 0; i < collections.length; ++i) { 3 print(collections[i] + ' - ' + db[collections[i]].count() + ' records'); 4} So, copy-paste this script in to text file and save as mongo-ls.js.
Finally, use the following command to query the database. Make sure you change HOSTNAME, DBNAME, USERNAME and PASSWORD with your own.