$npx skillfedfor your agent

mongomock

Fake pymongo stub for testing simple MongoDB-dependent code

Worth itPyPI DatabaseReleased Nov 20247.9M downloads / mopermissive licensePure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — mongomock-4.3.0-py2.py3-none-any.whl
v4.3.0 · released 2024-11-16 · 3 runtime deps: packaging, pytz, sentinels

Yes. Mongomock is production-stable, widely used, has no known vulnerabilities, and solves a real testing problem with low install friction. The aging maintenance status is a minor concern but the repository remains active and the ISC license is permissive. Install it if you test pymongo-dependent code.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Low install friction: pure Python wheel with only three runtime dependencies (packaging, pytz, sentinels).
  • Last release was 636 days ago; repository is active and not archived, though maintenance status is aging.

License · maintenance · safety

permissive license (permissive) — ISC License (permissive): you may use, modify, and distribute mongomock freely in commercial and private projects with minimal restrictions—only requiring preservation of copyright and license notices.

last release 2024-11-16 (636 days) · last repo commit 2025-06-30 · 1,003 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 7,923,784 downloads/mo, #1,680 on PyPI

Verify before relying

import mongomock

client = mongomock.MongoClient()
db = client.test_db
collection = db.test_collection

collection.insert_one({'name': 'test', 'value': 1})
result = collection.find_one({'name': 'test'})
print(result)
  • Completeness of MongoDB API coverage relative to pymongo v4—the description notes TDD-driven feature addition but does not enumerate which operations are supported.
  • Whether the package works with pymongo v5 or later versions beyond v4.
  • Monthly download volume and ranking position reflect current popularity but may not indicate active maintenance frequency.
Same gist for agents: .md · .json

What it is and what it does

Mongomock is a testing library that replaces pymongo's MongoClient with an in-memory mock, allowing you to test MongoDB-dependent code without setting up or managing a real MongoDB instance. It implements enough of the MongoDB API to behave like a real collection for typical query and update operations, making tests faster and more portable across CI environments and local machines.

The library is designed for functional testing rather than as a perfect replica of MongoDB. When a feature is not yet implemented, it raises NotImplementedError rather than silently behaving differently from production pymongo, ensuring your tests fail where production code would fail. It supports both direct instantiation (creating a mock client in your test) and decorator-based patching (intercepting pymongo.MongoClient calls in code under test).

Use it for

  • Unit test code that queries and updates MongoDB collections without spinning up a test database.
  • Run test suites in CI/CD pipelines where MongoDB infrastructure is unavailable or undesirable.
  • Validate application logic against MongoDB operations in isolation, comparing expected vs. actual collection state.
  • Migrate code from pymongo v3 to v4 by running tests against both versions to catch API incompatibilities early.
  • Mock MongoDB interactions in decorator-patched functions that create their own pymongo connections.

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

Worth it

Yes.

Mongomock is production-stable, widely used, has no known vulnerabilities, and solves a real testing problem with low install friction. The aging maintenance status is a minor concern but the repository remains active and the ISC license is permissive. Install it if you test pymongo-dependent code.

Install

mongomock on PyPI

Before you install

Low install friction: pure Python wheel with only three runtime dependencies (packaging, pytz, sentinels). Last release was 636 days ago; repository is active and not archived, though maintenance status is aging.

License in practice

ISC License (permissive): you may use, modify, and distribute mongomock freely in commercial and private projects with minimal restrictions—only requiring preservation of copyright and license notices.

Quickstart

import mongomock

client = mongomock.MongoClient()
db = client.test_db
collection = db.test_collection

collection.insert_one({'name': 'test', 'value': 1})
result = collection.find_one({'name': 'test'})
print(result)

Verify before relying

  • Completeness of MongoDB API coverage relative to pymongo v4—the description notes TDD-driven feature addition but does not enumerate which operations are supported.
  • Whether the package works with pymongo v5 or later versions beyond v4.
  • Monthly download volume and ranking position reflect current popularity but may not indicate active maintenance frequency.

Package facts

Licensepermissive license permissive
Python supportNot specified
Install frictionLow. Pure-Python wheel
Runtime dependencies
3 packages
packagingpytzsentinels
MaintenanceAging 636 days since the last release
Last repo commit
First released
Downloads7,923,784 / month, #1,680 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: ISC License (ISCL)Operating System :: MacOS :: MacOS XOperating System :: Microsoft :: WindowsOperating System :: POSIXProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Database

Evidence: mongomock-4.3.0-py2.py3-none-any.whl

Tags

Capabilities
mongodb mock testingpymongo test doublein-memory mongodbmongodb fake for testspymongo unit testingmongodb collection mocktest mongodb without server
Topics
testingmongodbmock

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 test double”

  • mongomockMongomock provides an in-memory mock of MongoDB collections for…
  • pymongo_inmemoryProvides an in-memory MongoDB instance for testing by wrapping…
  • mock-firestoreProvides an in-memory mock of the Google Cloud Firestore Python…

Give your agent the search over MCP, or paste the wish link into any chat.

More Database packages

psycopg2-binary Worth it
PyPI · Software Development · released Apr 2026

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.

copyleftcompiled wheel · 3.9+
271.6Mdownloads / mo
redis Worth it
PyPI · Database · released Jul 2026

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.

MITpure Python · 3.10+
268.3Mdownloads / mo
ydb Worth it
PyPI · Database · released Jul 2026

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.

permissive licensepure Python · 3.10+
210.0Mdownloads / mo
snowflake-connector-python Worth it
PyPI · Software Development · released Aug 2026

Connects Python applications to Snowflake data warehouses using the DB API 2.0 specification, enabling SQL queries, data transfers, and warehouse operations.

Apache-2.0compiled wheel · 3.10+
193.6Mdownloads / mo
sqlparse Worth it
PyPI · Software Development · released Aug 2026

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.

BSD-3-Clausepure Python · 3.10+
148.9Mdownloads / mo
dbt-adapters With conditions
PyPI · Database · released Jul 2026

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.

Apache-2.0pure Python · 3.10.0+
121.3Mdownloads / mo

See also mongomock-motor · pymongo_inmemory · pymongo · pymongoexplain · Flask-PyMongo · pymongo-auth-aws · pymongo-search-utils · pymongocrypt · bson · pymongoarrow