Find mongo document - Array of documents with nested array of strings

Viewed 98

I have a collection with documents with the following structure:

{_id: "28", cds: [{name: "myname", issue:["i1", "i2", "i3"]}]

How to find all documents where cds.issue[*] == "i3" for example? In other words where there is a string "i3" in the issue array.

1 Answers

Quite easy to achieve using Mongo' dot notation:

db.collection.find({"cds.issue": "i3"})
Related