Last December I had the opportunity to present a paper at PyChina Chengdu describing the development of a “mongo_objects” Python module that wraps both documents and subdocuments in user-defined classes.

Subdocuments are actually proxy objects that refer all data access back to the parent document, maintaining a single source of truth and preventing subdictionary fragments floating around your app. Subdocuments support single dictionaries, dictionaries of dictionaries and lists of dictionaries.

The first stable release of the module was published last week. I’ve found the proxy approach helpful in my own projects and am very interested to hear the community’s feedback.

Resources:
PyPI Module Page
Source Code on GitHub
Documentation on Read The Docs

But Wait, There’s More:
[PyChina Chengdu 2023 Conference Slides](https://headwaters.com.sg/static/cdn/MongoDB
Subdocument Proxy Objects.pptx)
Conference Video on Bilibili