MongoListField in 2.8.0 does not deserialize correctly
There's a bug in setFromDBObject caused by the change in scala 2.8.0 SetLike collections where .map returns a Set rather than an Iterable.
This causes ordering to be lost and duplicate values to be removed.
This causes ordering to be lost and duplicate values to be removed.
Leave a comment
I was actually looking at this yesterday and was going to submit a fix for it. I didn't notice that it removed dupe values, however. To fix it I moved the call to toList up to where the keySet is returned (see below), this should fix the dupe problem as well, but tests should be added. Also, note that I commented out the tests for this class because of this, but I didn't look at it at the time.
I can have a fix for this up within a couple of hours, if you want me to handle it.
Original:
def setFromDBObject(dbo: DBObject): Box[List[ListType]] =
setBox(Full(dbo.keySet.map(k =>
dbo.get(k.toString).asInstanceOf[ListType]).toList))
Fixed:
def setFromDBObject(dbo: DBObject): Box[List[ListType]] =
setBox(Full(dbo.keySet.toList.map(k =>
dbo.get(k.toString).asInstanceOf[ListType])))
I can have a fix for this up within a couple of hours, if you want me to handle it.
Original:
def setFromDBObject(dbo: DBObject): Box[List[ListType]] =
setBox(Full(dbo.keySet.map(k =>
dbo.get(k.toString).asInstanceOf[ListType]).toList))
Fixed:
def setFromDBObject(dbo: DBObject): Box[List[ListType]] =
setBox(Full(dbo.keySet.toList.map(k =>
dbo.get(k.toString).asInstanceOf[ListType])))
(In revision:c5b4d9cb1ee314427047195fc90fc90d6a4c5e83) Closes #651. MongoListField in 2.8.0 does not deserialize correctly
Branch: master
Branch: master
(In revision:c5b4d9cb1ee314427047195fc90fc90d6a4c5e83) Closes #651. MongoListField in 2.8.0 does not deserialize correctly
Branch: master
Branch: master