-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
def productToDocument(cc:Product)
...
val values = cc.productIterator
val fieldList = cc.getClass.getDeclaredFields.toList
...
val purifiedFromId = values.zip(fieldList.iterator).toList.filter { case (v, f) => !isId(f.getName, cc.getClass) }
values and fieldList are not guaranteed to be the same length. Some values may be saved with incorrect field names.
For example:
class TraceElement3( val date: Int )
case class LoginEvent3(val userID: Int)
case class TraceElementLoginEvent3( override val date: Int, val xx:String, val data: LoginEvent3 ) extends TraceElement3(date)
... the overridden value is hidden from the field list (two fields, three values).
Since loading matches fields to the document by case constructor's parameters, one solution to this is to look at the constructor's parameter list fieldList (and their annotations). This would also ensure reading and writing use the same policy to identify fields).
Am working on a fix for this.
Metadata
Metadata
Assignees
Labels
No labels