mongodb中db.getreplicationinfo()与rs.printreplicationinfo()之间的用例和区别是什么

时间:2017-10-18 13:50:18

标签: mongodb

1- db.getreplicationinfo()之间的用例和区别是什么     在mongodb中vs rs.printreplicationinfo()。当我运行两者     repliaset中的命令如下所示。任何人都可以解释我的     两个命令和用例之间的区别。

(mongod-3.4.9)[PRIMARY:s0] local> db.getReplicationInfo()`
`

{
  "logSizeMB": 6714.337890625,
  "usedMB": 208.66,
  "timeDiff": 2152896,
  "timeDiffHours": 598.03,
  "tFirst": "Sat Sep 23 2017 17:48:27 GMT+0530 (IST)",
  "tLast": "Wed Oct 18 2017 15:50:03 GMT+0530 (IST)",
  "now": "Wed Oct 18 2017 15:50:09 GMT+0530 (IST)"
}


(mongod-3.4.9)[PRIMARY:s0] local> db.getReplicationInfo()

{
  "logSizeMB": 6714.337890625,
  "usedMB": 208.66,
  "timeDiff": 2152896,
  "timeDiffHours": 598.03,
  "tFirst": "Sat Sep 23 2017 17:48:27 GMT+0530 (IST)",
  "tLast": "Wed Oct 18 2017:50:03 GMT+0530 (IST)",
  "now": "Wed Oct 18 2017 15:50:09 GMT+0530 (IST)"
}

1 个答案:

答案 0 :(得分:1)

根据文件: db.printReplicationInfo()格式化并打印db.getReplicationInfo()返回的数据:

db.getReplicationInfo()发回一个可以在脚本中使用的对象/文档。