Reputation: 358
I thought this would work to extract a List[String], but no. (anmKey is Option[String])
run(query[Anm].map(_.anmKey).flatMap(_))
Upvotes: 1
Views: 154
Reputation: 1480
To get rid of the options, and the nones, use flatten
scala> List(Some("string1"), None, Some("string2")).flatten
val res0: List[String] = List(string1, string2)
Alternatively, if you want to keep the options but remove the nones, you can use filter
.
scala> List(Some("string1"), None, Some("string2")).filter(_.isDefined)
val res1: List[Option[String]] = List(Some(string1), Some(string2))
Upvotes: 1