How to views all documents in a particular collection of database in MongoDB through mongo Shell?
OK, let's start from basics!

After you have connected to mongod with command mongo.


List databases with command show dbs


iot:PRIMARY&gt; show dbs
    admin  0.000GB 
    iot    0.020GB 
    local  0.042GB
    test   0.000GB 
    testi  0.000GB



Select one of the DB's with use iot command


iot:PRIMARY&gt; use iot

switched to db iot


List collections on that DB with show collections command


iot:PRIMARY&gt; show collections
data
header
key



Make query to one of those collections 


iot:PRIMARY&gt; db.header.find()
{ "_id" : "1b5caa", "temp1" : "Temperature", "pressure1" : "Pressure", "humidity1" : "Humidity", "uv1" : "UV", "BusV1" : "Solar Panel (V)", "Current1" : "Solar Panel Current (mA)", "BusV2" : "Battery (V)", "Current2" : "Battery Current (mA)" }
{ "_id" : "30444", "temp1" : "Temperature", "pressure1" : "Pressure", "humidity1" : "Humidity" }
{ "_id" : "239684", "temp1" : "Temperature", "pressure1" : "Pressure", "humidity1" : "Humidity" }


So, you need to be connected WANTED database with use command and you need to show the one collection what you want to query with db.&lt;collection_name&gt;.find()

How to see to what database I'm connected currently? Just give command db and you get the answer what is your current DB.