I want to create generic result models for RawCommand
using reactive mongo with play framework. But i got an error. Following is my generic models case class structure.
case class DistinctRawCommandResult[T] (
val values: List[T],
val stats: CommandStatus,
val ok: Double
)
case class CommandStatus(
val n: Int,
val nscanned: Int,
val nscannedObjects: Int,
val timems: Int,
val cursor: String
)
object DistinctRawCommandResultBsonFormatter {
implicit val commandStatusReader: BSONDocumentReader[CommandStatus] = Macros.reader[CommandStatus];
implicit val distinctRawCommandReader: BSONDocumentReader[DistinctRawCommandResult[T]] = Macros.reader[DistinctRawCommandResult[T]];
}
At line implicit val distinctRawCommandReader: BSONDocumentReader[DistinctRawCommandResult[T]] = Macros.reader[DistinctRawCommandResult[T]]
the error is generated: ◾not found: type T
because DistinctRawCommandResult
takes parameter. But when i use object DistinctRawCommandResultBsonFormatter[T]
, then this also generate an error.
How could i create generic result model for RawCommand
.