score:0

As Julien Lafont said, you should consider transforming this list before giving it to your template. For example if you just want a list of read files (on which you can call filename and id):

val fileList = files.toList.flatten.map(_._2) // fileList is a List[ReadFile[BSONValue]]]

And if you want just want to get filenames and their ids (given that their ids are BSONObjectIDs), you may write this:

val fileList = files.toList.flatten.map { file =>
  val id = file._2.id match {
    case oid: BSONObjectID => oid.stringify
    case id => id.toString
  }
  id -> file._2.filename
}
// fileList is a List[(String, String)] where the first element of the tuple is a string version of the id and the second is the name of the file.

Related Query

More Query from same tag