{"id":13771383,"url":"https://github.com/mongodb/pymodm","last_synced_at":"2025-10-08T18:30:53.291Z","repository":{"id":43669379,"uuid":"55078765","full_name":"mongodb/pymodm","owner":"mongodb","description":"A Pythonic, object-oriented interface for working with MongoDB.","archived":false,"fork":false,"pushed_at":"2023-04-10T12:46:48.000Z","size":593,"stargazers_count":353,"open_issues_count":2,"forks_count":67,"subscribers_count":47,"default_branch":"master","last_synced_at":"2025-01-19T17:04:21.900Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mongodb.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-03-30T16:24:59.000Z","updated_at":"2024-11-28T16:32:29.000Z","dependencies_parsed_at":"2024-01-06T21:59:11.942Z","dependency_job_id":null,"html_url":"https://github.com/mongodb/pymodm","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mongodb%2Fpymodm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mongodb%2Fpymodm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mongodb%2Fpymodm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mongodb%2Fpymodm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mongodb","download_url":"https://codeload.github.com/mongodb/pymodm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235741424,"owners_count":19038184,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T17:00:50.874Z","updated_at":"2025-10-08T18:30:47.923Z","avatar_url":"https://github.com/mongodb.png","language":"Python","readme":"======\nPyMODM\n======\n\n**MongoDB has paused the development of PyMODM.** If there are any users who want\nto take over and maintain this project, or if you just have questions, please respond\nto `this forum post \u003chttps://developer.mongodb.com/community/forums/t/updates-on-pymodm/9363\u003e`_.\n\n.. image:: https://readthedocs.org/projects/pymodm/badge/?version=stable\n   :alt: Documentation\n   :target: http://pymodm.readthedocs.io/en/stable/?badge=stable\n\n.. image:: https://travis-ci.org/mongodb/pymodm.svg?branch=master\n   :alt: View build status\n   :target: https://travis-ci.org/mongodb/pymodm\n\nA generic ODM around PyMongo_, the MongoDB Python driver. PyMODM works on Python\n2.7 as well as Python 3.3 and up. To learn more, you can browse the `official\ndocumentation`_ or take a look at some `examples`_.\n\n.. _PyMongo: https://pypi.python.org/pypi/pymongo\n.. _official documentation: http://pymodm.readthedocs.io/en/stable\n.. _examples: https://github.com/mongodb/pymodm/tree/master/example\n\nWhy PyMODM?\n===========\n\nPyMODM is a \"core\" ODM, meaning that it provides simple, extensible\nfunctionality that can be leveraged by other libraries to target platforms like\nDjango. At the same time, PyMODM is powerful enough to be used for developing\napplications on its own. Because MongoDB engineers are involved in developing\nand maintaining the project, PyMODM will also be quick to adopt new MongoDB\nfeatures.\n\nSupport / Feedback\n==================\n\nFor issues with, questions about, or feedback for PyMODM, please look into\nour `support channels \u003chttp://www.mongodb.org/about/support\u003e`_. Please do not\nemail any of the PyMODM developers directly with issues or questions -\nyou're more likely to get an answer on the `MongoDB Community Forums \u003chttps://developer.mongodb.com/community/forums/tags/c/drivers-odms-connectors/7/pymodm-odm\u003e`_.\n\nBugs / Feature Requests\n=======================\n\nThink you’ve found a bug? Want to see a new feature in PyMODM? Please open\na case in our issue management tool, JIRA:\n\n- `Create an account and login \u003chttps://jira.mongodb.org\u003e`_.\n- Navigate to `the PYMODM project \u003chttps://jira.mongodb.org/browse/PYMODM\u003e`_.\n- Click **Create Issue** - Please provide as much information as possible about the issue type and how to reproduce it.\n\nBug reports in JIRA for all driver projects (e.g. PYMODM, PYTHON, JAVA) and the\nCore Server (i.e. SERVER) project are **public**.\n\nHow To Ask For Help\n-------------------\n\nPlease include all of the following information when opening an issue:\n\n- Detailed steps to reproduce the problem, including full traceback, if possible.\n- The exact python version used, with patch level::\n\n  $ python -c \"import sys; print(sys.version)\"\n\n- The exact version of PyMODM used, with patch level::\n\n  $ python -c \"import pymodm; print(pymodm.version)\"\n\n- The PyMongo version used, with patch level::\n\n  $ python -c \"import pymongo; print(pymongo.version)\"\n\n- The operating system and version (e.g. Windows 7, OSX 10.8, ...)\n- Web framework or asynchronous network library used, if any, with version (e.g.\n  Django 1.7, mod_wsgi 4.3.0, gevent 1.0.1, Tornado 4.0.2, ...)\n\nSecurity Vulnerabilities\n------------------------\n\nIf you’ve identified a security vulnerability in a driver or any other\nMongoDB project, please report it according to the `instructions here\n\u003chttp://docs.mongodb.org/manual/tutorial/create-a-vulnerability-report\u003e`_.\n\nExample\n=======\n\nHere's a basic example of how to define some models and connect them to MongoDB:\n\n.. code-block:: python\n\n  from pymongo import TEXT\n  from pymongo.operations import IndexModel\n  from pymodm import connect, fields, MongoModel, EmbeddedMongoModel\n\n\n  # Connect to MongoDB first. PyMODM supports all URI options supported by\n  # PyMongo. Make sure also to specify a database in the connection string:\n  connect('mongodb://localhost:27017/myApp')\n\n\n  # Now let's define some Models.\n  class User(MongoModel):\n      # Use 'email' as the '_id' field in MongoDB.\n      email = fields.EmailField(primary_key=True)\n      fname = fields.CharField()\n      lname = fields.CharField()\n\n\n  class BlogPost(MongoModel):\n      # This field references the User model above.\n      # It's stored as a bson.objectid.ObjectId in MongoDB.\n      author = fields.ReferenceField(User)\n      title = fields.CharField(max_length=100)\n      content = fields.CharField()\n      tags = fields.ListField(fields.CharField(max_length=20))\n      # These Comment objects will be stored inside each Post document in the\n      # database.\n      comments = fields.EmbeddedModelListField('Comment')\n\n      class Meta:\n          # Text index on content can be used for text search.\n          indexes = [IndexModel([('content', TEXT)])]\n\n  # This is an \"embedded\" model and will be stored as a sub-document.\n  class Comment(EmbeddedMongoModel):\n      author = fields.ReferenceField(User)\n      body = fields.CharField()\n      vote_score = fields.IntegerField(min_value=0)\n\n\n  # Start the blog.\n  # We need to save these objects before referencing them later.\n  han_solo = User('mongoblogger@reallycoolmongostuff.com', 'Han', 'Solo').save()\n  chewbacca = User(\n      'someoneelse@reallycoolmongostuff.com', 'Chewbacca', 'Thomas').save()\n\n\n  post = BlogPost(\n      # Since this is a ReferenceField, we had to save han_solo first.\n      author=han_solo,\n      title=\"Five Crazy Health Foods Jabba Eats.\",\n      content=\"...\",\n      tags=['alien health', 'slideshow', 'jabba', 'huts'],\n      comments=[\n          Comment(author=chewbacca, body='Rrrrrrrrrrrrrrrr!', vote_score=42)\n      ]\n  ).save()\n\n\n  # Find objects using familiar MongoDB-style syntax.\n  slideshows = BlogPost.objects.raw({'tags': 'slideshow'})\n\n  # Only retrieve the 'title' field.\n  slideshow_titles = slideshows.only('title')\n\n  # u'Five Crazy Health Foods Jabba Eats.'\n  print(slideshow_titles.first().title)\n","funding_links":[],"categories":["ODM, ORM, Active Record"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmongodb%2Fpymodm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmongodb%2Fpymodm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmongodb%2Fpymodm/lists"}