graph LR
DatabaseAccess["DatabaseAccess"]
ModelManagement["ModelManagement"]
QueryAndManipulation["QueryAndManipulation"]
ReferenceResolution["ReferenceResolution"]
UtilityAndErrorHandling["UtilityAndErrorHandling"]
DatabaseAccess -- "Provides database connectivity" --> ModelManagement
ModelManagement -- "Persists and retrieves model data" --> DatabaseAccess
DatabaseAccess -- "Provides database connectivity" --> QueryAndManipulation
QueryAndManipulation -- "Executes operations via" --> DatabaseAccess
DatabaseAccess -- "Reports errors to" --> UtilityAndErrorHandling
ModelManagement -- "Defines structure for" --> QueryAndManipulation
QueryAndManipulation -- "Returns instances of" --> ModelManagement
ModelManagement -- "Triggers dereferencing" --> ReferenceResolution
ReferenceResolution -- "Instantiates models for" --> ModelManagement
ModelManagement -- "Utilizes validation from" --> UtilityAndErrorHandling
UtilityAndErrorHandling -- "Reports errors to" --> ModelManagement
ReferenceResolution -- "Fetches documents via" --> DatabaseAccess
click DatabaseAccess href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main/pymodm/DatabaseAccess.md" "Details"
click ModelManagement href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main/pymodm/ModelManagement.md" "Details"
click QueryAndManipulation href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main/pymodm/QueryAndManipulation.md" "Details"
click ReferenceResolution href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main/pymodm/ReferenceResolution.md" "Details"
click UtilityAndErrorHandling href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main/pymodm/UtilityAndErrorHandling.md" "Details"
The PyMODM architecture is designed around an Object-Document Mapper (ODM) pattern for MongoDB. The core data flow begins with the DatabaseAccess component establishing and managing connections to the MongoDB database. ModelManagement defines the schema and behavior of Python objects that map to MongoDB documents, utilizing UtilityAndErrorHandling for data validation and error reporting. QueryAndManipulation provides the primary interface for users to interact with the database, executing queries and operations on ModelManagement instances through DatabaseAccess. For complex relationships, ReferenceResolution handles the automatic fetching and instantiation of linked documents, also relying on DatabaseAccess for data retrieval and ModelManagement for object creation. UtilityAndErrorHandling serves as a cross-cutting concern, providing essential services like validation and error management to all other components.
Manages connections to MongoDB and handles low-level data storage and retrieval operations, including GridFS for file management.
Related Classes/Methods:
pymodm.connection:connect(44:81)pymodm.connection:_get_connection(84:92)pymodm.connection:_get_db(95:97)pymodm.files.GridFSStorage(67:141)pymodm.files.GridFSFile(312:351)pymodm.files.FieldFile(207:275)
Defines the structure and behavior of PyMODM models, including field definitions, data serialization/deserialization, validation, and persistence.
Related Classes/Methods:
pymodm.base.models.MongoModelMetaclass(34:141)pymodm.base.models.TopLevelMongoModelMetaclass(144:183)pymodm.base.models.MongoModelBase(186:399)pymodm.base.models.TopLevelMongoModel(402:528)pymodm.base.models.MongoModel(531:600)pymodm.base.models.EmbeddedMongoModel(603:605)pymodm.base.models.MongoModelBase:save(380:419)pymodm.base.models.MongoModelBase:full_clean(371:384)pymodm.base.models.MongoModelBase:to_son(292:314)pymodm.base.models.MongoModelBase:from_document(268:290)pymodm.base.fields.MongoBaseField(25:220)pymodm.fields.CharField(100:103)pymodm.fields.ObjectIdField(110:113)pymodm.fields.DateTimeField(116:119)pymodm.fields.FileField(200:203)pymodm.fields.ReferenceField(206:290)pymodm.fields.EmbeddedModelField(293:300)pymodm.fields.ListField(303:310)pymodm.fields.DictField(313:320)
Provides the API for building and executing database queries, enabling filtering, ordering, and bulk data operations on models.
Related Classes/Methods:
pymodm.queryset.QuerySet(26:564)pymodm.queryset.QuerySet:get(75:117)pymodm.queryset.QuerySet:all(185:187)pymodm.queryset.QuerySet:raw(201:218)pymodm.queryset.QuerySet:order_by(220:231)pymodm.queryset.QuerySet:bulk_create(393:434)pymodm.queryset.QuerySet:delete(436:490)pymodm.manager.BaseManager(23:108)pymodm.manager.Manager(111:166)
Handles the automatic resolution and attachment of referenced MongoDB documents (DBRefs) to their corresponding model instances.
Related Classes/Methods:
pymodm.dereference.dereference(167:198)pymodm.dereference._find_references(69:87)pymodm.dereference._attach_objects(144:164)
Provides common utility functions, general-purpose data validation, and defines a structured system for reporting various operational and validation errors across the library.
Related Classes/Methods:
pymodm.errors.ValidationError(41:79)pymodm.errors.ConfigurationError(86:87)pymodm.errors.OperationError(82:83)pymodm.errors.ModelDoesNotExist(31:33)pymodm.errors.InvalidModel(36:38)pymodm.common.get_document(60:72)pymodm.common.validate_string_or_none(86:89)pymodm.common.validate_mongo_field_name(92:108)pymodm.common.validate_mongo_keys(111:119)pymodm.common.validate_ordering(169:180)pymodm.validators.validator_for_func(26:33)pymodm.validators.validator_for_type(36:48)