Solution: Reading Arrays
We'll cover the following...
Query
db.products.find({tags: { $elemMatch: { $regex: /\busb\b/i } }},{name: 1,category: 1,tags: 1,_id: 0})
The explanation of the query is given below:
Line 1: This begins a query on the
productscollection using thefind()method. This tells MongoDB that we want to retrieve documents from theproductscollection that match ...