I've got a Json like that, I want to get name of each Data ReplSet (but I 
don't suppose to know their name). And in each Data ReplSet I want only to
get the datasize, indexsize and storagesize. I don't find any issues.
{
"raw" : {
"data01ReplSet/Data01-01:27024,Data01-02:27025" : {
"db" : "admin",
"collections" : 2.0,
"objects" : 2.0,
"avgObjSize" : 168.5,
"dataSize" : 337.0,
"storageSize" : 32768.0,
"numExtents" : 0.0,
"indexes" : 3.0,
"indexSize" : 49152.0,
"ok" : 1.0,
"$gleStats" : {
"lastOpTime" : Timestamp(0, 0),
"electionId" : ObjectId("7fffffff0000000000000002")
}
},
"data02ReplSet/Data02-01:27026,Data02-02:27027" : {
"db" : "admin",
"collections" : 2.0,
"objects" : 2.0,
"avgObjSize" : 168.5,
"dataSize" : 337.0,
"storageSize" : 32768.0,
"numExtents" : 0.0,
"indexes" : 3.0,
"indexSize" : 49152.0,
"ok" : 1.0,
"$gleStats" : {
"lastOpTime" : Timestamp(0, 0),
"electionId" : ObjectId("7fffffff0000000000000002")
}
}
},
"objects" : 4.0,
"avgObjSize" : 168.0,
"dataSize" : 674.0,
"storageSize" : 65536.0,
"numExtents" : 0.0,
"indexes" : 6.0,
"indexSize" : 98304.0,
"fileSize" : 0.0,
"extentFreeList" : {
"num" : 0.0,
"totalSize" : 0.0
},
"ok" : 1.0
}
I tried something like that but doesn't work :
internal class ReplNameStatus
{
public string name { get; set; }
}
internal class DBRplStatus
{
public double dataSize { get; set; }
public double storageSize { get; set; }
public double indexSize { get; set; }
}
var RsModel = BsonSerializer.Deserialize<Dictionary<ReplNameStatus,
DBRplStatus>>(commandResult["raw"].ToJson());
Lucas Leprestre 's gravatar image asked Feb 17 2017 at 05:12 in Mongodb-User by Lucas Leprestre

0 Answers

Related Discussions