db.inventory.find( { type: 'food' }, { item: 1, qty: 1 } )
In above example from the folks at Mongo, the returned documents will contain only the fields of item, qty, and _id.
db.inventory.find( { type: 'food' }, { item: 1, qty: 0 } )
In above example from the folks at Mongo, the returned documents will contain only the fields of item, and _id.
References:
Top comments (0)