Hi,
I am new to Couchbase. We have a requirement to update documents with a new field. The value of that new field needs to be populated from a reference CSV file. Please help me with the right query / solution to achieve the same. Given the example below
Existing individual documents in same bucket
{
“A_list”: [
{
“doc_type”: “Books”,
“stud_id”: “1001”,
“spm_id”: “profile_1001”,
“sms”: “I”,
“email”: “O”,
},
{
“doc_type”: “Books”,
“stud_id”: “1002”,
“spm_id”: “profile_1002”,
“sms”: “O”,
“email”: “O”,
},
{
“doc_type”: “CDs”,
“stud_id”: “1003”,
“spm_id”: “obj_1003”,
“sms”: “O”,
“email”: “I”,
}
]
}
Input CSV
stud_id,xyz_id
1001,9001
1002,9010
1003,9081
Desired Output
{
“A_list”: [
{
“doc_type”: “Books”,
“stud_id”: “1001”,
“xyz_id”:“9001”,
“spm_id”: “profile_1001”,
“sms”: “I”,
“email”: “O”,
},
{
“doc_type”: “Books”,
“stud_id”: “1002”,
“xyz_id”:“9010”,
“spm_id”: “profile_1002”,
“sms”: “O”,
“email”: “O”,
},
{
“doc_type”: “CDs”,
“stud_id”: “1003”,
“xyz_id”:“9081”,
“spm_id”: “obj_1003”,
“sms”: “O”,
“email”: “I”,
}
]
}
Thank you,
Regards,
jayant