Build Cloud-Native apps with Apache Cassandra

GOT QUESTIONS from the Workshop? You're in the right place! Post a question here and we'll get you answers.

Click here for Week 7 Materials and Homework.

Registrations still open!


question

veeraragavan.g_193502 avatar image
veeraragavan.g_193502 asked ·

Can we use set datatype instead of json?

[FOLLOW UP QUESTION TO #6319]

Can we use set datatype instead of json

data modeling
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered ·

The CQL set collection type is a list of unique values of another CQL data type (e.g. text, int) or a user-defined type (UDT). For example, you can have a column in a table which contains the names of friends like this:

    friends set<text>

It's difficult to answer your question without additional background information but it doesn't make sense to store JSON documents into a CQL collection unless your JSON looks something like:

{
  "friends": [
    'Tom',
    'Dick',
    'Harry'
  ]
}

If you provide an example of your data in JSON format, I'd be happy to review it and give you a better response. Cheers!

Share
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.