java.lang.ClassCastException: com.mongodb.BasicDBList cannot be cast to scala.collection.immutable.List with a List inside a Map

203 views
Skip to first unread message

Miguel Angel Iglesias

unread,
Jul 31, 2014, 4:58:59 PM7/31/14
to scala...@googlegroups.com
I've seen this problem over and over again in the group and in the issues, apparently it should be solved, but for some reason I have the problem.

My thing is really straightforward:

The field in question has this form by default,

{ "1" : [ ] , "2" : [ ] , "3" : [ ] , "4" : [ ] , "5" : [ ] , "6" : [ ] , "7" : [ ]}

those [] are actually meant to contain an array of elements like this one: {"start": 12121,"end": 12121}

The problem is happening with the empty arrays, don't know if it will occur with data in the arrays, haven't have time to mock it up.

The case class for what goes inside the arrays is:

case class MidnightRange(start: Int,end: Int)

and the map is declared like this:

Map[String, List[MidnightRange]]

Any idea of what can be going on?

Anton Stamov

unread,
Jul 8, 2015, 11:54:36 AM7/8/15
to scala...@googlegroups.com


четверг, 31 июля 2014 г., 23:58:59 UTC+3 пользователь Miguel Angel Iglesias написал:
I have the similar problem, but with List[List[Double]: 
I have the following structure:

case class A(list: List[List[Double]])

case class B(a: A)

case class C(id: ObjectId, b:B)

when I trying to get from Mongo saved object with type of C and get access to list (something like c.b.a.list.head) I get ClassCastException: com.mongodb.BasicDBList cannot be cast to scala.collection.Traversable
What can be cause of this? 

rose katherine toomey

unread,
Jul 8, 2015, 11:56:34 AM7/8/15
to scala...@googlegroups.com

Nested lists are not supported.

Maps whose values are lists are not supported.



--
You received this message because you are subscribed to the Google Groups "scala-salat" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-salat...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages