How to select a sub-fields of a document using N1ql query


#1

Can I Select the child element of a particular field using N1ql Query???

Example:-
“content”: {
“_id”: “88w73c9e-f7ed-4816-7778-5247e69cd77450”,
“_type”: “Publish”,
“author”: “abcd”,
“book”: {
“$ref”: “03ee49ec-4452-4ebs-9f49-9f3aa4rra53f”,
“_type”: “Book”
},
}

how to fetch “&ref” and “_type” from book field??How can I write a select query for it?


#2
INSERT INTO default VALUES("k01",{ "_id": "88w73c9e-f7ed-4816-7778-5247e69cd77450", "_type": "Publish", "author": "abcd", "book": { "$ref": "03ee49ec-4452-4ebs-9f49-9f3aa4rra53f", "_type": "Book" } });
SELECT  d.book.`$ref`, d.book.`_type`  FROM default AS d WHERE d.`_type` = "PUBLISH";

#3

Thank u.It’s working.