38.7.5.2. getDbStats
等同于在 MongoDB shell 中运行 db.stats()
命令,该命令显示与数据库相关的有用统计图。
例如:
用法示例:
// from("direct:getDbStats").to("mongodb:myDb?database=flights&collection=tickets&operation=getDbStats"); Object result = template.requestBody("direct:getDbStats", "irrelevantBody"); assertTrue("Result is not of type Document", result instanceof Document);
// from("direct:getDbStats").to("mongodb:myDb?database=flights&collection=tickets&operation=getDbStats");
Object result = template.requestBody("direct:getDbStats", "irrelevantBody");
assertTrue("Result is not of type Document", result instanceof Document);
该操作将返回类似于 shell 中显示的数据结构,其格式为 OUT 消息正文。