mongodb only get one field code example
Example 1: return only specific fields mongodb
db.inventory.find( { status: "A" }, { item: 1, status: 1 } )
Example 2: find only one field mongodb
db.students.find({}, {roll:1, _id:0})
db.inventory.find( { status: "A" }, { item: 1, status: 1 } )
db.students.find({}, {roll:1, _id:0})