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