Check out example codes for "mongo remove all dbs". It will help you in understanding the concepts better.
Code Example 1
mongo --quiet --eval 'db.getMongo().getDBNames().forEach(function(i){db.getSiblingDB(i).dropDatabase()})'
Learn ReactJs, React Native from akashmittal.com