mongomock/mongomock
Small library for mocking pymongo collection objects for testing purposes observed · 2026-09-03
Health v2 · maintenance only
43/100
- Activity 29
- Release rhythm 28
- Longevity 100
How is this computed?
round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10) — computed 2026-09-03. Adoption (stars, forks) is never an input.
- gap_med: 68
- age_days: 5285
- days_rel: 653
- days_push: 429
- n_releases_24m: 2
Adoption not part of the score
1003 stars · 359 forks observed · 2026-09-03
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-09-03 · 50645de3035f
- registry_pypi: https://pypi.org/pypi/mongomock/json · fetched 2026-08-29 · 2e59e8655f12
Member repositories
| Repository | Role | Health v2 |
|---|---|---|
| mongomock/mongomock | main | 43 |
For agents
markdown · JSON · MCP: product_card(name="mongomock/mongomock")
Data as of 2026-08-30T08:39:29.467469+00:00 · Report a problem