N1QL query format


#1

Hi All,

Below is the document format that I have stored in couchdb

“A”:{
“B”:
{
“B1”: [
{ “C1”: [ “ticket_number” : “1234”] ,“C2” :[“ticket_number” : “674746”] }]

}
}

suppose i have to get value of ticket_number what will be the query format in N1QL


#2

The Query is not valid json.

  {
        "A": {
            "B": {
                "B1": [
                    {
                        "C1": [
                            {
                                "ticket_number": "1234"
                            }
                        ],
                        "C2": [
                            {
                                "ticket_number": "674746"
                            }
                        ]
                    }
                ]
            }
        }
    }

INSERT INTO default VALUES ("f1",    { "A": { "B": { "B1": [ { "C1": [ { "ticket_number": "1234" } ], "C2": [ { "ticket_number": "674746" } ] } ] } } });
SELECT dt.ticket_number
FROM default AS d
UNNEST d.A.B.B1 AS du
UNNEST du.C1 AS dt

#3

Apologies i missed to braces on top… Thanks for your reply . :slight_smile: