Skip to content

Instantly share code, notes, and snippets.

@aphyr
Created February 17, 2015 22:48
Show Gist options
  • Save aphyr/20f3c41ef44f97ca2090 to your computer and use it in GitHub Desktop.
Save aphyr/20f3c41ef44f97ca2090 to your computer and use it in GitHub Desktop.
MongoDB "printjson" printing I don't know what
root@n1:~# mongo --quiet --eval 'printjson(rs.status())'
{
"set" : "jepsen",
"date" : ISODate("2015-02-17T22:48:35Z"),
"myState" : 1,
"members" : [
{
"_id" : 0,
"name" : "n1:27017",
"health" : 1,
"state" : 1,
"stateStr" : "PRIMARY",
"uptime" : 293,
"optime" : Timestamp(1424205484, 1),
"optimeDate" : ISODate("2015-02-17T20:38:04Z"),
"electionTime" : Timestamp(1424213022, 11),
"electionDate" : ISODate("2015-02-17T22:43:42Z"),
"self" : true
}
],
"ok" : 1
}
@yorickpeterse
Copy link

But this makes perfect sense. You see, Mongo has this thing called "BSON" which is totally 100% compatible with JSON, therefor there's no point in adding a function such as printbson because we can already use printjson.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment