0

I've a document structure below (simplified):

 {
"id": "2345",
"camp{
    "id": 999
    "code": "C1244
    "offers": [
        {
            "status": "active",
            "description": "Commence Loyalty At Year 6"
        },
        {
            "status": "inactive"
            "description": "abcd test
        }
    }
}

Where I would like to filter the offers where status is active. Can someone help me with what the query may look like for this?

0

1 Answer 1

1

Please try something like this sql:

SELECT  c.camp.id,c.camp.code,d AS offer FROM c join d in c.camp.offers where d.status = 'active'

Here is the result:

[
    {
        "id": 999,
        "code": "C1244",
        "offer": {
            "status": "active",
            "description": "Commence Loyalty At Year 6"
        }
    }
]

Hope this can help you:).

Sign up to request clarification or add additional context in comments.

Comments

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.