Hello-
I am new to N1QL and while going through the online interactive tutorial at https://query-tutorial.couchbase.com/tutorial I thought about the below question. The data set for the query is a subset of the documents from the tutorial bucket as shown below
I need to query tutorial.fname and age, fname of the child with the max age in the children array.
For the below data set I expect to get values -
Dave, 17, Aiden
Earl,17,Xena
Can you please provide any inputs.
{
“tutorial”: {
“age”: 46,
“children”: [
{
“age”: 17,
“fname”: “Aiden”,
“gender”: “m”
},
{
“age”: 2,
“fname”: “Bill”,
“gender”: “f”
}
],
“email”: "dave@gmail.com",
“fname”: “Dave”,
“hobbies”: [
“golf”,
“surfing”
],
“lname”: “Smith”,
“relation”: “friend”,
“title”: “Mr.”,
“type”: “contact”
}
},
{
“tutorial”: {
“age”: 46,
“children”: [
{
“age”: 17,
“fname”: “Xena”,
“gender”: “f”
},
{
“age”: 2,
“fname”: “Yuri”,
“gender”: “m”
}
],
“email”: "earl@gmail.com",
“fname”: “Earl”,
“hobbies”: [
“surfing”
],
“lname”: “Johnson”,
“relation”: “friend”,
“title”: “Mr.”,
“type”: “contact”
}
}