{"categories":[{"label":"Database","url":"https://skillfed.io/packages/category/database"}],"enrichment":{"capability":"Mongomock provides an in-memory mock of MongoDB collections for testing Python code that uses pymongo, without requiring a running MongoDB instance.","skillfed_tags":["testing","mongodb","mock"],"use_cases":["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."],"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.\n\nThe 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).","worth_installing":"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."},"id":"mongomock","links":{"html":"https://skillfed.io/packages/mongomock","md":"https://skillfed.io/packages/mongomock.md","pypi":"https://pypi.org/project/mongomock/"},"maintenance":{"status":"aging"},"meta":{"latest_release":"2024-11-16","license_spdx":null,"license_treatment":"permissive","name":"mongomock","python_support":"unspecified","summary":"Fake pymongo stub for testing simple MongoDB-dependent code"},"popularity":{"monthly_downloads":7923784,"position":1680,"tier":"top_5000"},"security":{"n_vulnerabilities":0},"version":"4.3.0"}
