Tag: projection

62 votes
22 answers
3K views
How to select a single field for all documents in a MongoDB collection?

In my MongoDB, I have a student collection with 10 records having fields name and roll. One record of this col

avatar
Serina
0 1 0 9
asked 07 September, 2021
59 votes
14 answers
2.5K views
Retrieve only the queried element in an object array in MongoDB collection

Suppose you have the following documents in my collection: { "_id":ObjectId("562e7c594c12942f08fe4192"),

avatar
Clarice
0 1 0 9
asked 07 September, 2021