Skip to content
Advertisement

MongoDB shell’s db.stats() in php and python

I can see the statistics from Mongo shell as

JavaScript

or

JavaScript

How do I view statistics of a database, or of a collection, from PHP and Python.

EDIT: I have done it in PHP but still cant do it in Python.

Help?

Advertisement

Answer

This is how you do it in Python if you are using the PyMongo driver:

JavaScript

References:

  • db.command()
  • MongoDB: how to get db.stats() from API
  • User contributions licensed under: CC BY-SA
    2 People found this is helpful
    Advertisement