MongoDB: Example query
9 February 2024 (Updated 9 February 2024)
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
Thanks for your comment 🙏. Once it's approved, it will appear here.
Leave a comment