Reading Nested documents?

There is lot buzz around securing consumer data, recently California State implemented CCPA(California Consumer Privacy Act). Is there any work going on with respect to this act.

We have program running in our company for other db technologies to identify PI entities.

But with couchbase we are having problems in reading Nested documents to figure out PI attributes and not sure how accurate that will be if we read through cli.

Wondering if anyone are working on the same thing.

If you are using N1QL could you please post the sample document and what you are looking in that sample document.

{
“airline”: “AF”,
“airlineid”: “airline_137”,
“destinationairport”: “MRS”,
“distance”: 2881.617376098415,
“equipment”: “320”,
“id”: 10000,
“schedule”: [
{
“day”: 0,
“flight”: “AF198”,
“utc”: “10:13:00”
},
{
“day”: 1,
“flight”: “AF356”,
“utc”: “12:40:00”
},
{
“day”: 2,
“flight”: “AF997”,
“utc”: “00:31:00”
},
{
“day”: 3,
“flight”: “AF074”,
“utc”: “23:50:00”
},
{
“day”: 4,
“flight”: “AF496”,
“utc”: “07:00:00”
}
],
“sourceairport”: “TLV”,
“stops”: 0,
“type”: “route”
}

if we see Schedule attribute has set of documents nested into it, now i want to read attributes alone from this nested document along with the main document.

with below query, able to retrieve parent attributes (airline,airlineid,destinationairport,distance,equipment,id,schedule,sourceairport,stops,type).

question is how do i retrieve other nested attributes (day,flight,utc)

SELECT OBJECT_NAMES(bucket-name) FROM
bucket-name WHERE META().id = “8011100600098923”

OBJECT_NAMES() gives one level only, If you need nested provide path name. OBJECT_NAMES( bucket-name.schedule[0] )

I am able to read all the nested attributes using the below query. I want to list them in a tabular format.

SELECT OBJECT_INNER_PAIRS(bucket-name)
FROM bucket-name LIMIT 1;

Example :
if i have a nested document like below. I want them to list as schedule,day,flight,utc. Do we have any function or procedure to do that.

“schedule”: [
{
“day”: 0,
“flight”: “AF198”,
“utc”: “10:13:00”
},

SELECT  ARRAY_DISTINCT(ARRAY v[0] FOR v IN PAIRS(d) END) 
FROM default AS d
LIMIT 1;

thanks @vsr1…this helps, one more question. if we want this in schema notation meaning path of the attribute. is it possible to get that.

Example: If i have a document like below, i want the output as distance, equipment, id, schedule.day,schedule.flight,schedule.utc

“distance”: 2881.617376098415,
“equipment”: “320”,
“id”: 10000,
“schedule”: [
{
“day”: 0,
“flight”: “AF198”,
“utc”: “10:13:00”
}

At present it is not possible in the N1QL. You can track improvement MB-34609

Thank you @vsr1…this helps