【发布时间】:2015-10-09 07:56:27
【问题描述】:
我想使用响应式 mongo 和 play 框架为 RawCommand 创建通用结果模型。但我有一个错误。以下是我的通用模型案例类结构。
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]];
}
在implicit val distinctRawCommandReader: BSONDocumentReader[DistinctRawCommandResult[T]] = Macros.reader[DistinctRawCommandResult[T]] 行生成错误:◾not found: type T 因为DistinctRawCommandResult 带参数。但是当我使用object DistinctRawCommandResultBsonFormatter[T] 时,这也会产生错误。
我如何为RawCommand 创建通用结果模型。
【问题讨论】:
-
下一个版本将提供一个独特的命令。同时你可以从master上编码:github.com/ReactiveMongo/ReactiveMongo/pull/411
标签: mongodb scala reactive-programming playframework-2.3 reactivemongo