Created
May 6, 2013 13:22
-
-
Save comerford/5525099 to your computer and use it in GitHub Desktop.
How to make oplogMainRowCount appear on MongoDB
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// delete oplog, crete new and empty | |
testReplSet:PRIMARY> use local | |
switched to db local | |
testReplSet:PRIMARY> db.oplog.rs.drop() | |
true | |
testReplSet:PRIMARY> db.createCollection("oplog.rs", {capped:1, size: 2*1024*1024, autoIndexId:false}) | |
{ "ok" : 1 } | |
// run the command to get the fields | |
testReplSet:PRIMARY> db.getReplicationInfo() | |
{ | |
"logSizeMB" : 2, | |
"usedMB" : 0, | |
"errmsg" : "objects not found in local.oplog.$main -- is this a new and empty db instance?", | |
"oplogMainRowCount" : 0 | |
} | |
// insert anything, to populate the oplog | |
testReplSet:PRIMARY> use test | |
switched to db test | |
testReplSet:PRIMARY> db.foo.insert({"a" : 1}) | |
// and now the extra fields are gone | |
testReplSet:PRIMARY> db.getReplicationInfo() | |
{ | |
"logSizeMB" : 2, | |
"usedMB" : 0.01, | |
"timeDiff" : 0, | |
"timeDiffHours" : 0, | |
"tFirst" : "Mon May 06 2013 14:17:09 GMT+0100 (IST)", | |
"tLast" : "Mon May 06 2013 14:17:09 GMT+0100 (IST)", | |
"now" : "Mon May 06 2013 14:17:11 GMT+0100 (IST)" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment