Tsallaka zuwa abun ciki
Justice Tech School

Projection

The second argument chooses which fields to return. 1 includes, 0 excludes. _id is returned unless you set it to 0.

Example
db.students.find({}, { name: 1, _id: 0 })
// { name: "Ada" }
// { name: "Bob" }

Exercise

Hide _id.

{ _id:  }

Quiz Test

What does { name: 1 } do?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.