get only certain fields mongo 4 code example
Example 1: return only specific fields mongodb
db.inventory.find( { status: "A" }, { item: 1, status: 1 } )
Example 2: get only some fields of document in mongodb
db.student.find({}, {roll:1, _id:0})
same as SELECT roll FROM student