Answers for "how to get specific field from a madel in mongodb"

Go
7

mongodb select specific fields

db.student.find({}, 'roll _id'); // <--- Just multiple fields name space separated
// OR
db.student.find({}).select('roll _id'); // <--- Just multiple fields name space separated
// OR
db.student.find({}, {'roll' : 1 , '_id' : 1 ); // <---- Old lengthy boring way
Posted by: Guest on December-07-2020

Code answers related to "how to get specific field from a madel in mongodb"

Browse Popular Code Answers by Language