sajad torkamani
db.Company.find({"address.postcode": "ABC 123"}).limit(2).projection({
    "name": 1,
    "industry": 1,
    "address.street": 1,
    "address.postcode": 1,
})

This will get all the documents from the Company collection where the address.postcode field is "ABC 123" and only return the following fields:

  • name
  • industry
  • address.street
  • address.postcode
Tagged: MongoDB

Leave a comment

Your email address will not be published. Required fields are marked *