反应性 mongo db.command 弃用
Reactive mongo db.command deprecation
我使用 db.command 函数主要对请求进行计数,但在新的更新中我发现此函数已被弃用,并出现以下我不理解的消息:
考虑使用 reactivemongo.api.commands 和 GenericDB.runCommand
方法
我没有找到此弃用的迁移指南。
这段代码现在实际上可以替代什么?
val totalFuture: Future[Int] = db.command(
Count(
"collection",
Some(BSONFormats.toBSON(Json.obj("key"->"value")).get.asInstanceOf[BSONDocument])
)
)
如果您阅读 documentation,您会看到 .count
操作现在可以直接在集合上使用,并且您会看到 RawCommand
未实现命令的用法示例.
我使用 db.command 函数主要对请求进行计数,但在新的更新中我发现此函数已被弃用,并出现以下我不理解的消息:
考虑使用 reactivemongo.api.commands 和 GenericDB.runCommand
方法
我没有找到此弃用的迁移指南。
这段代码现在实际上可以替代什么?
val totalFuture: Future[Int] = db.command(
Count(
"collection",
Some(BSONFormats.toBSON(Json.obj("key"->"value")).get.asInstanceOf[BSONDocument])
)
)
如果您阅读 documentation,您会看到 .count
操作现在可以直接在集合上使用,并且您会看到 RawCommand
未实现命令的用法示例.