N1QL result structure


#1

The structure of my document is

{
  "CF": {
    "afe": "1234",
    "area": "test",  
  },
  "id": "0019919e",
  "location": "USA",
  "invoice": "888"
}

I want to write a N1Ql query that gives result as follows

{
  "CF": {
    "afe": "1234"
  },
  "id": "0019919e"
}

The N1Ql query > select id, CF.afe from test_bucket where id = '0019919e' gives the following result

  {
    "afe": "1234",
    "id": "0019919e"
  }

How can the nested structure of “CF” property be preserved in the result? I don’t want to select the whole “CF” property as it will include unwanted properties.


#2
select id, {CF.afe} AS CF
from test_bucket 
where id = '0019919e'

#3

Thank you, vsr1 :grinning: