Retrive the data from Mongo DB

After Successful insertion of data into Mongo DB, there are different ways to retrieve the data from Collections, like Sql we can retrieve all the data from the collection or else we can retrieve the values of specific value by passing input to the retrieving Query.
Some basic Examples to retrieve the data from Mongo DB



To get all the details from the studentDetails

db.studentDetails.find()


To get all the details from studentDetails with Student_name as Raghav

db.studentDetails.find({Student_name:"Raghav"})


To get all the details from studentDetails with Student_name as Raghav and Ga Eul

db.studentDetails.find({Student_name:{$in :["Raghav","Ga Eul"]}})


Aggregate using less-than

db.studentDetails.find({Percentage:{$lt:85}})


Aggregate using less-than greater-than

db.studentDetails.find({Percentage:{$gt:85}})


Or in mongo DB

db.studentDetails.find({Student_name:"Ga Eul",$or:[{"Percentage":"96%"}]