sona11

sona11

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.

“targetMarket”:[
    “UK”,
    “IN”
]

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.

2 633 0

Where Next?

Popular Backend topics Top

New
wolf4earth
At work we plan to replace a totally overkill Kafka instance with a combination of SNS and SQS. I don’t want to get into a discussion on ...
3 725 0
New
DevotionGeo
I know that -t flag is used along with -i flag for getting an interactive shell. But I cannot digest what the man page for docker run com...
7 7340 2
New
dimitarvp
Hey everyone, I resumed work on my Elixir <=> SQLite library (which uses a Rust NIF underneath) and I am in a need of small and we...
11 1074 6
New
GermaVinsmoke
Reading Programming Elixir 1.6 book, I’ve completed part 1 of the book. Now I’m thinking of reading Elixir in Action. What do you all sug...
34 1793 8
New
TwistingTwists
Hello Folks, I am a novice developer from India. Intending to learn Elixir and web apps (phoenix framework). What are things that I MUS...
53 1463 14
New
osbre
Hello everyone I’m trying to implement a “magic link” or “one-time login link” functionality I wonder what a secure way to implement it...
9 874 2
New
MarkIden
Hi, Recommend pls your favorite learning resources in Go, with best books, podcasts etc.
/go
6 1155 5
New
Fl4m3Ph03n1x
Background I have recently been delving into more functional code. My objective right now is to get something similar to the IO Monad (in...
3 827 1
New
sona11
I studied very basic PHP (I believe). After that, I feel like I’ve gotten a handle on the language. My dream is to work as a web develope...
9 921 2
New

Other popular topics Top

ohm
Which, if any, games do you play? On what platform? I just bought (and completed) Minecraft Dungeons for my Nintendo Switch. Other than ...
245 5335 101
New
wolf4earth
@AstonJ prompted me to open this topic after I mentioned in the lockdown thread how I started to do a lot more for my fitness. https://f...
193 4510 82
New
AstonJ
You might be thinking we should just ask who’s not using VSCode :joy: however there are some new additions in the space that might give V...
118 4871 60
New
Exadra37
On modern versions of macOS, you simply can’t power on your computer, launch a text editor or eBook reader, and write or read, without a ...
24 3679 24
New
AstonJ
Inspired by this post from @Carter, which languages, frameworks or other tech or tools do you think is killing it right now? :upside_down...
160 3807 49
New
mafinar
Crystal recently reached version 1. I had been following it for awhile but never got to really learn it. Most languages I picked up out o...
155 4360 65
New
AstonJ
If you want a quick and easy way to block any website on your Mac using Little Snitch simply… File > New Rule: And select Deny, O...
5 8045 3
New
PragmaticBookshelf
Author Spotlight: VM Brasseur @vmbrasseur We have a treat for you today! We turn the spotlight onto Open Source as we sit down with V...
16 4113 11
New
PragmaticBookshelf
Author Spotlight: Tammy Coron @Paradox927 Gaming, and writing games in particular, is about passion, vision, experience, and immersio...
36 3521 18
New
PragmaticBookshelf
Author Spotlight: Peter Ullrich @PJUllrich Data is at the core of every business, but it is useless if nobody can access and analyze ...
72 3959 21
New