In Couchbase, how do you change the datatype of an attribute from String to Array?

I’m having a difficulty. I want to modify an attribute’s data type from String to Array.

    “id”: “trn:tarb:tradingpartner:uuid:00000464-fa72-49fe-b050-c4bf1cfd8259”,
    “partnerNumber”: “1098981”,
    “partnerName”: "AFLO ",
    “currencyCode”: “GBP”,
    “commercialPartnerStatus”: “Inactive”,
    “source”: {
        “id”: “STV0001$$”,
        “name”: “QS”
    “corpCode”: “DR”,
    “subCorpCode”: “001”,
    “targetMarket”: “UK”

In the preceding one, I want to convert targetMarket from String to Array without affecting its name.


The issue is with the old data, which is in string format, and if I alter the attribute in java, I receive an error while retrieving data from the database. It cannot automatically cast from string to arrayList. As a result, I must first modify the old data before changing the java code. It’s good with me if the data is null or erased after transforming the object from string to array.

1 Like

Corresponding tweet for this thread:

Share link for this tweet.

1 Like