MongoDB: Return subset of fields
28 July 2022 (Updated 28 July 2022)
MongoDB Compass project
field:
{ item: 1, status: 1 }
MongoDB Shell:
db.inventory.find( { status: "A" }, { item: 1, status: 1, _id: 0 } )
Tagged:
MongoDB
Thanks for your comment 🙏. Once it's approved, it will appear here.
Leave a comment