if pymongo.version >= "3.2.2":
mongos_conn = pymongo.MongoClient(host, port)
else:
mongos_conn = pymongo.Connection(host, port)
chunks_count = mongos_conn.config.chunks.count()#rs.conf()
shards_count = mongos_conn.config.shards.count()#rs.conf()
sharded_collections = mongos_conn.config.collections.count()#db.collection.count()
I am unable to Get these value in Go using "gopkg.in/mgo.v2"
var shards, getSiblingDB bson.M
This to Get the Shards Count
shards_count = mongos_conn.config.shards.count()#rs.conf()
if err := session.DB("admin").Run(bson.D{{"listShards", 1}}, &shards); err != nil {
fmt.Println("listShards error info::", err)
}
fmt.Println("shards : ", shards)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
sharded_collections = mongos_conn.config.collections.count()#db.collection.count()
sharded_collections, err := session.DB("admin").C("config").Count()
if err != nil {
fmt.Println("config Collection count error info : ", err)
}
fmt.Println("sharded_collections : ", sharded_collections)
Guys Please help Me count
Thanks
Vijay