MongoMeter
MongoDB aggregation pipeline performance checker
Install
pip install mongometer
Console
Example
Input
mongometer --url="mongodb://test:test@localhost:27017" --db=shop --collection bikes --path agg.json
Output
Processing ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:00
$match ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:00
$set ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:00
$match ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:00
$lookup ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:00
$unwind ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:00
$unwind ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:00
$project ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:00
$sort ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:00
$facet ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:00
$set ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:00
Results
┏━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ ┃ Name ┃ Time (seconds) ┃
┡━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━┩
│ 1 │ $match │ 1.5710415840148926 │
│ 2 │ $set │ 0.0 │
│ 3 │ $match │ 0.0 │
│ 4 │ $lookup │ 0.00015425682067871094 │
│ 5 │ $unwind │ 0.0014383792877197266 │
│ 6 │ $unwind │ 0.003248453140258789 │
│ 7 │ $project │ 0.06569337844848633 │
│ 8 │ $sort │ 3.276400566101074 │
│ 9 │ $facet │ 0.5028722286224365 │
│ 10 │ $set │ 0.0 │
└────┴──────────┴────────────────────────┘
Parameters
Usage: mongometer [OPTIONS]
Options:
--url TEXT MongoDB connection string [required]
--db TEXT MongoDB database name [required]
--collection TEXT MongoDB collection name [required]
--path TEXT Path to the aggregation pipeline json file [required]
--repeat INTEGER Number of repeats
--help Show this message and exit.
Python code
from mongometer import AggregationChecker
URI = "mongodb://test:test@localhost:27017"
DB_NAME = "shop"
COLLECTION_NAME = "bikes"
PIPELINE = [
{
"$match": {
"$text": {"$search": "John"},
}
},
{
"$sort": {
"created_at": 1
}
}
]
checker = AggregationChecker(URI, DB_NAME, COLLECTION_NAME)
checker.measure(pipeline=PIPELINE).print()
Metadata
Release files for mongometer 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mongometer-0.1.0.tar.gz | 4.7 kB | Without provenance | Details for mongometer-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mongometer-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for mongometer-0.1.0-py3-none-any.whl |
Total release size: 10.4 kB
Release files / mongometer-0.1.0.tar.gz
| Download URL | mongometer-0.1.0.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d44482a995bfa6d9b0b08423bf1f685af8902e055d5928a647d5ed6be1a6a3da
|
|
BLAKE2b-256 checksum How to use checksums |
72d0110864b3664650f482b9c94feb35bb56a6c49028ef0143e6d17a34e9d959
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.13 CPython/3.8.13 Linux/5.15.0-39-generic
|
Release files / mongometer-0.1.0-py3-none-any.whl
| Download URL | mongometer-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bedb79209b1a6a5e278e7ade4e9920cb3cfaed78708796283defa01faa15b8a4
|
|
BLAKE2b-256 checksum How to use checksums |
1923a82a42f3b1af874959e6b15e75cb944e4297a082c07f97bd5f0b63a9be46
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.13 CPython/3.8.13 Linux/5.15.0-39-generic
|
Security for mongometer 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.