mongodb.com get data with some feilds code example
Example 1: 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
Example 2: mongo console find by id
db.collection.find({_id:ObjectId('5e208c18d598b806c869ca37')}).pretty()