2017-10-18 38 views
1

1-在mongodb中,db.getreplicationinfo() 與rs.printreplicationinfo()之間的用例和區別是什麼。當我在repliaset中運行 命令時,結果如下。任何人都可以解釋我的兩個命令和用例之間的差異。mongodb中的db.getreplicationinfo()與rs.printreplicationinfo()之間的用法和區別是什麼

(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

根據文檔: db.printReplicationInfo()格式,然後打印db.getReplicationInfo(返回的數據):

db.getReplicationInfo()返回一個對象/文件,你可以在腳本中使用。

相關問題