Chapter 1, MongoClient, client.stats

Hi,

It’s maybe silly question but in Jupiter Notebook in Chapter 1 where it’s explaining MongoClient there is a command:

client.stats

that gives following info:

Database(MongoClient(host=['mflix-shard-00-01.9go7j.mongodb.net:27017', 'mflix-shard-00-00.9go7j.mongodb.net:27017', 'mflix-shard-00-02.9go7j.mongodb.net:27017'], document_class=dict, tz_aware=False, connect=True, authsource='admin', replicaset='atlas-js08eu-shard-0', ssl=True), 'stats')

Where this command comes from? There is nothing in API documentation on MongoClient. If I do

dir(client)

the stats is not shown as one of the available class methods.

What gives?

Hi @mattjavaly,

Can you please take a look at this post ?

~ Shubham

Hi @Dejan_Batic,

I am not sure if I understand your question right. But in jupyter notebook, we are using pymongo which returns client object after successfull connection with Mongo using MongoClient. Here is the documentation I found helpful for the notebook:

client.stats just outputs the connection response consisting of nodes you are connecting to and basic configuration stats.

Kanika

Hi kanikasingla

Thank you for you time.

I’m trying to understand where exactly that

.stats

command comes from. It’s not a method from client object and I don’t see it in MongoClient documentation.