Need Assistance?

support@tutorialshub.in

CRUD Operations: Create & Read

Projection (Selecting Specific Fields)

ADVERTISEMENT
MongoDB Free Lesson
5 min read
ADVERTISEMENT

By default, find() returns every field in a document. Passing a second object (the projection) lets you include (1) or exclude (0) specific fields to reduce network bandwidth.

Rule: You cannot mix 1 and 0 in the same projection—except for _id: 0.

ADVERTISEMENT
Hi, I'm Tuby! Here to help you