Hello i need help in the bellow structure, i want to query name only from the below, with the condition if name = "name1"

Hello i need help in the bellow structure, i want to query name only from the below, with the condition if name = “name1”

[
  {
    "bucket_name": {
      "_class": "com.test.cloud.myclass.entity.CarModelsClass",
      "publishStatus": "yes",
      "CarModel": {
        "CarColor": "red",
        "modelsWithLanguages": [
          {
            "status": "new",
            "modelDetails": {
              "en-US": {
                "models": [
                  "german panda - 422",
                  "italian panda - 422"
                ],
                "name": "name1"
              },
              "it-IT": {
                "models": [
                  "german panda - 422",
                  "italian panda - 422",
                  "panda-4221234567890"
                ],
                "name": "name2"
              }
            }
          },
          {
            "status": "new",
            "modelDetails": {
              "en-US": {
                "models": [
                  "german panda - 422",
                  "italian panda - 422",
                  "panda-4221234567890"
                ]
                "name": "name3"
              },
              "it-IT": {
                "models": [
                  "german panda - 422",
                  "italian panda - 422",
                  "panda-4221234567890"
                ],
                "name": "name4"
              }
            }
          }
        ]
      }
    }
  }
]
SELECT md.*
FROM default AS d
UNNEST d.CarModel.modelsWithLanguages AS ml
UNNEST OBJECT_PAIRS(ml.modelDetails) AS md
WHERE d._class = "com.test.cloud.myclass.entity.CarModelsClass"
md.val.name = "name1";
1 Like

thank you so much @vsr1 it works, you saved my day :slight_smile: