2

I have the following json

{
"car-id": "54-38ncv",
"cars": [
{
"name": "Ferrari",
"horse-powers": 400
},
{
"name": "BMW",
"horse-powers": 200
},
{
"name": "Audi",
"horse-powers": 145
}]
}

the id is custom set by me. Imagine that there are hundreds other documents in my azure cosmos db collection. I want to create query that selects the first document that has a car in the cars that is named etc. "Ferrari". I know that they are maybe a dublicates, but is want the first one. Is there a quarry for this.

1 Answer 1

1

You can do this,

SELECT TOP 1 FROM c JOIN cc IN c.cars WHERE cc.name IN ("Ferrari")
Sign up to request clarification or add additional context in comments.

2 Comments

Great. I was overcomplicating the solution!
mark if the answer helped

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.