{"categories":[{"label":"Database","url":"https://skillfed.io/packages/category/database/4"}],"enrichment":{"capability":"Provides a Repository pattern for MongoDB with Pydantic model integration, supporting both synchronous and asynchronous CRUD operations with built-in validation and serialization.","skillfed_tags":["mongodb-orm","pydantic-integration","async-support"],"use_cases":["Building a REST API where each endpoint maps to a Pydantic model stored in MongoDB, with automatic validation on save.","Writing async FastAPI handlers that query MongoDB without writing raw pymongo code or managing connection pooling manually.","Migrating from a different ORM to MongoDB while keeping your existing Pydantic schemas and validation logic.","Implementing cursor-based pagination for large result sets in a web application.","Defining type-safe repository classes for unit testing with mock repositories that share the same interface."],"what_it_does":"Pydantic Mongo is a thin wrapper around pymongo that applies the Repository pattern, letting you define MongoDB collections as Pydantic models and interact with them through a type-safe, validated interface. It handles the boilerplate of connecting Pydantic's validation and serialization to MongoDB's document model, so you define your schema once as a Pydantic class and then use repository methods (save, find_one_by_id, find_by, delete, etc.) to perform CRUD operations without writing raw MongoDB queries.\n\nThe package supports both synchronous (via AbstractRepository) and asynchronous (via AsyncAbstractRepository) workflows, making it suitable for blocking and non-blocking applications. It depends on pymongo for the driver layer and pydantic for validation, so you inherit both their capabilities and constraints\u2014notably, you still need a MongoDB server running, and your models must be valid Pydantic classes.","worth_installing":"Yes, if you are already using Pydantic and MongoDB together. The package reduces boilerplate and provides a clean, type-safe interface for common CRUD patterns. Maintenance is aging but active, with no security issues. Install friction is low. The main trade-off is that you are adding a thin abstraction layer\u2014if you need fine-grained control over MongoDB queries or aggregation pipelines, you may find the repository pattern limiting and prefer working directly with pymongo."},"id":"pydantic-mongo","links":{"html":"https://skillfed.io/packages/pydantic-mongo","md":"https://skillfed.io/packages/pydantic-mongo.md","pypi":"https://pypi.org/project/pydantic-mongo/"},"maintenance":{"status":"aging"},"meta":{"latest_release":"2025-04-18","license_spdx":null,"license_treatment":"permissive","name":"pydantic-mongo","python_support":"supports_current","summary":"Document object mapper for pydantic and pymongo"},"popularity":{"monthly_downloads":182303,"position":10104,"tier":"top_15000"},"security":{"n_vulnerabilities":0},"version":"3.1.0"}
