Search code examples
scalacassandraphantom-dsl

How to query from ListColumn[String] in cassandra using phantom


I am new to cassandra (started learning on my own interest few days back) and looking for help for the below problem.

I have a Cassandra table "User" and a ListColumn "interests extends ListColumn[String]". Now, I want to fetch all users with an interest, say "playing".

like: select from user where interests.contains("playing")! I scanned through the ListColumn api but not able to find any. Also, searched in google but no such helpful posts.

Any help guys please... Thanks in Advance :)


Solution

  • So there is contains among operators and here is an example how to use it. It looks like that it should work as any other operator, so just go for database.userTable.select.where(_.interests contains "playing").fetch() - of course, depending on your conventions.