mongomock/mongomock
Some data may be outdated — see provenance labels.
Small library for mocking pymongo collection objects for testing purposes observed · 2026-10-01
Health v2 · maintenance only
32/100
- Activity 21
- Release rhythm 8
- Longevity 100
How is this computed?
round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10) — computed 2026-10-21. Adoption (stars, forks) is never an input.
- gap_med: n/a
- age_days: 5333
- days_rel: 701
- days_push: 477
- n_releases_24m: 1
Adoption not part of the score
1005 stars · 359 forks observed · 2026-10-01
What it is AI-extracted, prompt v1, taxonomy v1, 2026-08-30, confidence not recorded
Mongomock is a small Python library that provides a fake in-memory implementation of pymongo collection objects for testing MongoDB-dependent code. It lets unit tests run without a real MongoDB server while exercising the same query and update API.
Use cases
- unit test python code that uses pymongo without a mongodb server
- run mongodb-dependent tests in CI without database setup
- replace a real mongo collection with an in-memory fake in tests
- test mongodb queries and updates deterministically
- avoid record-replay mocks when testing database code
When to choose
- you want fast, dependency-free unit tests for pymongo-based code
- you cannot easily provision or clean a real MongoDB instance in your test environment
- your code uses simple MongoDB operations supported by the fake
When to avoid
- you need to test against real MongoDB behavior, server features, or aggregation fidelity
- your code relies on advanced MongoDB features mongomock does not implement
- you are doing integration or end-to-end testing where a real database is available
Facets
library · maturity maintenance
mocking testing database-driver testing databases developer-tools python mongodb pymongo test-doubles unit-testing
2 sources
- readme: https://github.com/mongomock/mongomock · fetched 2026-10-01 · 50645de3035f
- registry_pypi: https://pypi.org/pypi/mongomock/json · fetched 2026-08-29 · 2e59e8655f12
Member repositories
| Repository | Role | Health v2 |
|---|---|---|
| mongomock/mongomock | main | 32 |
For agents
markdown · JSON · MCP: product_card(name="mongomock/mongomock")
Data as of 2026-10-19T08:05:51.212177+00:00 · Report a problem