Reputation: 13
How can I run db.runCommand("serverStatus") in scala 2.11.4? I'm using play2-reactivemongo 0.10.5.0.akka23 ? The db.command takes RawCommand in reactiveMongo which in turn is a BSONDocument. How to run commands of database like db.serverStatus() or db.printShardingStatus()
Thanks
Upvotes: 0
Views: 459
Reputation: 13
Found the solution:
def statusCheck(dbConn: String = "db"): Future[JsObject] = {
val commandDoc =
BSONDocument(
"serverStatus" -> 1)
val result = db.command(RawCommand(commandDoc))
result.map { doc =>
Json.toJson(doc).asInstanceOf[JsObject]
} }
Upvotes: 1