227.6.5.2. getDbStats
等同于在 MongoDB shell 中运行 db.stats ()
命令,这会显示有关数据库的有用统计数字。
例如:
usage 示例:
// 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 DBObject", result instanceof DBObject);
// 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 DBObject", result instanceof DBObject);
该操作将返回与 shell 中显示的数据结构,其格式为 OUT 消息正文中的 DBObject
。