query in mongodb project code example
Example 1: mongodb project all fields
db.collection.aggregate([
{ "$addFields": { "custom_field": "$obj.obj_field1" } }
])
Example 2: how to project specific field mongodb nodejs
db.inventory.find( { status: "A" }, { item: 1, status: 1 } )
//1 to show and 0 to hide
//_id always included need to be set to 0 if not needed