So pretty new and absolutely uneducated on MongoDB.
Having this JSON structure:
{ "id": "123456", "makes": { "abc": { "att1": 4, "att2": "fffff", "att3": 46 }, "fgh": { "att1": 8, "att2": "ggggg", "att3": 6 }, "rty": { "att1": 3, "att2": "hhhh", "att3": 4 }, "iop": { "att1": 4, "att2": "llll", "att3": 3 } } }
how can I query the DB for "fgh" make? I tried:
db.<myCollection>.find({"makes":"fgh"}) but that doesn't work. It works fine if I write:
db.<myCollection>.find({"makes.fgh.att1":8}) thank you in advance!