Skip to main content

MongoDB aggregation pipeline performance checker

Project description

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()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mongometer-0.1.0.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mongometer-0.1.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file mongometer-0.1.0.tar.gz.

File metadata

  • Download URL: mongometer-0.1.0.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.8.13 Linux/5.15.0-39-generic

File hashes

Hashes for mongometer-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d44482a995bfa6d9b0b08423bf1f685af8902e055d5928a647d5ed6be1a6a3da
MD5 c409df2e01c716f8e68b7801b91bcb34
BLAKE2b-256 72d0110864b3664650f482b9c94feb35bb56a6c49028ef0143e6d17a34e9d959

See more details on using hashes here.

File details

Details for the file mongometer-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mongometer-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.8.13 Linux/5.15.0-39-generic

File hashes

Hashes for mongometer-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bedb79209b1a6a5e278e7ade4e9920cb3cfaed78708796283defa01faa15b8a4
MD5 f190636b7adad79276324fd4a5b95080
BLAKE2b-256 1923a82a42f3b1af874959e6b15e75cb944e4297a082c07f97bd5f0b63a9be46

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page