Articles → MONGODB → Projections In MongodbProjections In MongodbThis article describes projections in MongoDB.Purpose Projections in MongoDB allow you to precisely select only the data you need from a document, instead of retrieving the entire document.Example When querying a document with the find method, we set the flag to 0 (zero) for fields we do not want to retrieve.Consider the following table: -We require fetching only the subject field, not the _id field. Therefore, we will use the following query: -db.Articles.find({}, {subject:1, _id:0})Output Posted By - Karan Gupta Posted On - Friday, March 17, 2023 Query/Feedback Your Email Id** Subject* Query/Feedback Characters remaining 250**
db.Articles.find({}, {subject:1, _id:0})
Query/Feedback