pymongoexplain
Explainable CRUD API for PyMongo
Decision gist · record as of 2026-08-14
Yes, if you need to inspect MongoDB query execution plans from PyMongo code. The package is stable with no known vulnerabilities and low install friction. However, verify PyMongo version compatibility first—the documented constraint is PyMongo>=3.10,<4, which may limit use in newer projects. Best suited for development and optimization workflows.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires PyMongo>=3.10,<4.
- Fluent Cursor API (chained methods like .find().sort()) is not supported—pass all arguments directly to find().
- Low friction: pure Python wheel with a single runtime dependency on pymongo.
License · maintenance · safety
Apache License, Version 2.0 (permissive) — Apache License, Version 2.0 (permissive): you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.
last release 2022-01-07 (1680 days) · last repo commit 2026-08-03 · 4 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 80,630 downloads/mo, #14,280 on PyPI
Alternatives
Verify before relying
pip install pymongoexplain
from pymongoexplain import ExplainableCollection
collection = client.db.products
explain = ExplainableCollection(collection)
result = explain.update_one({"quantity": 1057}, {"$set": {"reorder": True}})
print(result) # Contains queryPlanner output, not actual update- Whether the package works with PyMongo 4.x versions despite the documented constraint
- Performance overhead of wrapping Collection methods for large-scale explain operations
- Current maintenance status given 1680 days since last release despite active repository
What it is and what it does
PyMongoExplain provides an ExplainableCollection wrapper that intercepts PyMongo CRUD operations and runs MongoDB's explain command on them instead of executing the actual operation. This lets you inspect query plans, index usage, and execution strategy without modifying your data. It supports all Collection methods (find, insert_one, update_one, delete_many, etc.) and accepts explain options like verbosity and comment.
The package simplifies what would otherwise require manually constructing MongoDB command objects. It also includes a CLI tool to run explain on all operations in an existing script. The wrapper is designed to drop into existing code by swapping Collection instances for ExplainableCollection instances, making it useful for performance analysis and query optimization workflows.
Use it for
- Analyze query plans for slow update or delete operations without running them against production data
- Debug index usage and rejection patterns before committing schema changes
- Profile all database operations in a script to identify optimization opportunities
- Compare execution plans across different query formulations to choose the most efficient one
- Audit which indexes MongoDB would use for a set of operations without side effects
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need to inspect MongoDB query execution plans from PyMongo code.
The package is stable with no known vulnerabilities and low install friction. However, verify PyMongo version compatibility first—the documented constraint is PyMongo>=3.10,<4, which may limit use in newer projects. Best suited for development and optimization workflows.
Install
pymongoexplain on PyPI
Before you install
Low friction: pure Python wheel with a single runtime dependency on pymongo. Maintenance is active but infrequent—last release was over 1680 days ago, though the repository remains current as of August 2026.
Requires PyMongo>=3.10,<4. Fluent Cursor API (chained methods like .find().sort()) is not supported—pass all arguments directly to find().
License in practice
Apache License, Version 2.0 (permissive): you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.
Quickstart
pip install pymongoexplain
from pymongoexplain import ExplainableCollection
collection = client.db.products
explain = ExplainableCollection(collection)
result = explain.update_one({"quantity": 1057}, {"$set": {"reorder": True}})
print(result) # Contains queryPlanner output, not actual update
Verify before relying
- Whether the package works with PyMongo 4.x versions despite the documented constraint
- Performance overhead of wrapping Collection methods for large-scale explain operations
- Current maintenance status given 1680 days since last release despite active repository
Package facts
| License | Apache License, Version 2.0 permissive |
| Python support | Supports the current Python release >=3.5 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagepymongo |
| Maintenance | Actively maintained 1,680 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 80,630 / month, #14,280 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseOperating System :: MacOS :: MacOS XOperating System :: Microsoft :: WindowsOperating System :: POSIXProgramming Language :: Python :: 3Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Database |
Evidence: pymongoexplain-1.2.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “pymongo query explain”
- pymongoexplainWraps PyMongo's Collection class to explain database operations…
- opentelemetry-instrumentation-pymongoAdds automatic tracing and observability instrumentation for pymongo…
- pymongoPyMongo is the official MongoDB Python driver, providing synchronous…
Give your agent the search over MCP, or paste the wish link into any chat.
More Database packages
psycopg2-binary is a PostgreSQL database adapter for Python that implements the DB API 2.0 specification, enabling Python applications to connect to and query PostgreSQL databases with thread-safe concurrent operations.
Python client library for connecting to and executing commands against Redis key-value stores, supporting both synchronous and asynchronous operations.
Install it if your application needs to interact with Redis; the only prerequisite is a running Redis server instance.
YDB Python SDK is the official client library for connecting to and querying YDB databases from Python applications.
Install it if you need to connect Python applications to YDB databases.
Connects Python applications to Snowflake data warehouses using the DB API 2.0 specification, enabling SQL queries, data transfers, and warehouse operations.
sqlparse tokenizes SQL text into a tree of statements, clauses, and expressions, and provides functions to split scripts, format queries, and inspect parsed tokens without validating dialect or syntax.
Install it if you need to manipulate, format, or analyze SQL text programmatically.
Provides base adapter protocols and shared functionality that database adapters use to integrate with dbt-core, handling connections, dialect translation, relation caching, and core interface management.
See also Flask-PyMongo · pymongo · pymongo-search-utils · pymongoarrow · pydantic-mongo · mongomock · mongoengine · pymongo-auth-aws · pymongo_inmemory · curatorbin