{"id":13486565,"url":"https://github.com/codello/Motor-ODM","last_synced_at":"2025-03-27T21:30:35.552Z","repository":{"id":57443325,"uuid":"253462574","full_name":"codello/Motor-ODM","owner":"codello","description":"A MongoDB ODM based on Motor and Pydantic.","archived":false,"fork":false,"pushed_at":"2024-09-03T20:56:58.000Z","size":98,"stargazers_count":17,"open_issues_count":15,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-02T06:54:59.742Z","etag":null,"topics":["asyncio","mongodb","motor","odm","pydantic","pymongo","python3"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codello.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-06T10:18:51.000Z","updated_at":"2024-01-07T09:11:11.000Z","dependencies_parsed_at":"2022-09-08T09:50:11.809Z","dependency_job_id":null,"html_url":"https://github.com/codello/Motor-ODM","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codello%2FMotor-ODM","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codello%2FMotor-ODM/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codello%2FMotor-ODM/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codello%2FMotor-ODM/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codello","download_url":"https://codeload.github.com/codello/Motor-ODM/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222314023,"owners_count":16965427,"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":["asyncio","mongodb","motor","odm","pydantic","pymongo","python3"],"created_at":"2024-07-31T18:00:48.392Z","updated_at":"2024-10-30T21:31:55.181Z","avatar_url":"https://github.com/codello.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# Motor-ODM\n[![Build](https://github.com/Codello/Motor-ODM/workflows/Build/badge.svg)](https://github.com/Codello/Motor-ODM/actions?query=workflow%3ABuild)\n[![Documentation Status](https://readthedocs.org/projects/motor-odm/badge/?version=latest)](https://motor-odm.readthedocs.io/en/latest/?badge=latest)\n[![Codecov](https://img.shields.io/codecov/c/github/Codello/Motor-ODM)](https://codecov.io/gh/Codello/Motor-ODM)\n[![Requirements Status](https://requires.io/github/Codello/Motor-ODM/requirements.svg?branch=master)](https://requires.io/github/Codello/Motor-ODM/requirements/?branch=master)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/Motor-ODM)](https://pypi.org/project/Motor-ODM/)\n[![PyPI](https://img.shields.io/pypi/v/Motor-ODM)](https://pypi.org/project/Motor-ODM/)\n\n![License](https://img.shields.io/github/license/Codello/Motor-ODM)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\nA MongoDB ODM based on Motor and Pydantic.\n\nThe project code is hosted on [GitHub](https://github.com/Codello/Motor-ODM), documentation on [ReadTheDocs](https://motor-odm.readthedocs.io/).\n\n\n## Installation\n\n```shell script\npip install Motor-ODM\n```\n\n## Quick Start\n```python\nfrom motor.motor_asyncio import AsyncIOMotorClient\nfrom motor_odm import Document\n\n# Create a custom model by subclassing Document\nclass User(Document):\n    class Mongo:\n        # Set the collection name\n        collection = \"users\"\n    \n    # Add attributes to your model\n    username: str\n    age: int\n\n# Connect your model to a database\nclient = AsyncIOMotorClient(...)\nDocument.use(client.get_default_database())\n\n# Create documents and save them to the database\nu = User(username=\"John\", age=20)\nawait u.insert()\n\n# Query the database\nasync for user in User.all():\n    print(user.username)\n```\n\nFor a more complete overview have a look at the [docs](https://motor-odm.readthedocs.io/).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodello%2FMotor-ODM","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodello%2FMotor-ODM","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodello%2FMotor-ODM/lists"}