pm
unread,Aug 16, 2011, 2:01:23 AM8/16/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to mongodb-user
how to write a query against rs.status() to get details of a specific
member in a set. I'm trying this to do in DB Shell.
I can get details based on member array index
foo:PRIMARY> rs.status().members[0].optime.t
1312133994000
but how to write something like get me optime where name="MacBook-
Pro-2.local:27017"
below is my sample rs.status() output.
foo:PRIMARY> rs.status();
{
"set" : "foo",
"date" : ISODate("2011-08-16T05:52:51Z"),
"myState" : 1,
"members" : [
{
"_id" : 0,
"name" : "MacBook-Pro-2.local:27017",
"health" : 1,
"state" : 1,
"stateStr" : "PRIMARY",
"optime" : {
"t" : 1312133994000,
"i" : 1
},
"optimeDate" : ISODate("2011-07-31T17:39:54Z"),
"self" : true
},
{
"_id" : 1,
"name" : "MacBook-Pro-2.local:27018",
"health" : 1,
"state" : 2,
"stateStr" : "SECONDARY",
"uptime" : 1389,
"optime" : {
"t" : 1312133994000,
"i" : 1
},
"optimeDate" : ISODate("2011-07-31T17:39:54Z"),
"lastHeartbeat" : ISODate("2011-08-16T05:52:50Z")
},
{
"_id" : 2,
"name" : "MacBook-Pro-2.local:27019",
"health" : 1,
"state" : 2,
"stateStr" : "SECONDARY",
"uptime" : 1389,
"optime" : {
"t" : 1312133994000,
"i" : 1
},
"optimeDate" : ISODate("2011-07-31T17:39:54Z"),
"lastHeartbeat" : ISODate("2011-08-16T05:52:50Z")
}
],
"ok" : 1
}