Select Necessary Data (Projection)

Author: Al-mamun Sarkar Date: 2020-09-11 14:51:56

In this lesson, I will show how you can select only the necessary column for inside find query.

Query Example:

Find the only name and email from employees collection:

db.employees.find({}, {name:1, email:1})

 Find the only name and email and skip _id:

db.employees.find({}, {name:1, email:1, _id:0})