-1

I've been looking at some StackOverflow cases such as this case, but I cannot find an example with a document structure close to this one.

Below is an example of one document within my collection artistTags. All documents follow the same structure.

{
  "_id": ObjectId("5500aaeaa7ef65c7460fa3d9"),
  "toptags": {
    "tag": [
      {
        "count": "100",
        "name": "Hip-Hop"
      },
      {
        "count": "97",
        "name": "french rap"
      },
      ...{
        "count": "0",
        "name": "seen live"
      }
    ],
    "@attr": {
      "artist": "113"
    }
  }
}

1) How can I find() this document using the "artist" value (here "113")?

2) How can I retrieve all "artist" values having a specific "name" value (say "french rap") ?

Community
  • 1
  • 1
guzu92
  • 737
  • 1
  • 12
  • 28

1 Answers1

2

Referring to chridam answer here above:

db.collection.find({"[email protected]": "113"})
Community
  • 1
  • 1
guzu92
  • 737
  • 1
  • 12
  • 28