mtools

raw JSON →
1.7.2 verified Fri May 01 auth: no python

A collection of useful Python scripts to parse and visualize MongoDB log files (mloginfo, mlogfilter, mplotqueries), launch test MongoDB environments (mlaunch), and reproduce MongoDB issues. Current version is 1.7.2. Release cadence is irregular, with occasional minor/patch releases.

pip install mtools
error ModuleNotFoundError: No module named 'mlaunch'
cause Attempting to import mlaunch directly from the top-level package.
fix
Use 'from mtools.mlaunch import mlaunch' instead.
error pkg_resources.DistributionNotFound: The 'pymongo' distribution was not found and is required by mtools
cause PyMongo is not installed or is an incompatible version (<4.0 for mtools>=1.7.1).
fix
Run 'pip install pymongo>=4.0' or downgrade mtools to 1.7.0.
breaking mtools v1.6.0 dropped Python 2.7 support. Python 3.6+ is required. Upgrade Python if you are on an older version.
fix Upgrade Python to 3.6+ and install mtools >=1.6.0.
breaking mtools v1.7.1 requires PyMongo >=4.0. Older PyMongo versions are incompatible. This may break scripts relying on PyMongo 3.x API.
fix Upgrade PyMongo to 4.0+ or pin mtools to 1.7.0 if you must use PyMongo 3.x.
gotcha mlaunch requires a mongod binary available in PATH. If not found, it fails silently or with confusing errors.
fix Ensure MongoDB tools are installed and mongod is in your PATH.
deprecated mlaunch's --sslWeakCertificateValidation is removed in v1.6.2. Use --tlsAllowInvalidCertificates instead.
fix Replace --sslWeakCertificateValidation with --tlsAllowInvalidCertificates.

Launch a MongoDB test environment with mlaunch.

from mtools.mlaunch import mlaunch
# Start a replica set with 3 nodes
mlaunch.init('replicaset', name='myrepl', nodes=3, auth=False)
print('Replica set launched. Use mlaunch.stop() to stop.')