Select Necessary Data (Projection)

Select Necessary Data (Projection)

Instructor-svgAl-Mamun Sarkar
Sep 11 , 2020

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})

 

  • Share On:
  • fb
  • twitter
  • pinterest
  • instagram