Skip to main content

MangoODM

MangoODM — lightweight and easy-to-use ODM (Object Document Mapper) library for Python, designed to work asynchronously with MongoDB using the motor driver.
Supports Pydantic models and MongoDB sessions.


Features

  • Simple model definition using Pydantic
  • Model registration and automatic collection handling
  • Asynchronous CRUD operations: insert, find, update, delete
  • Support for MongoDB sessions for transaction safety
  • Logging for important events and errors

Installation

pip install mangodb.py

Usage

Define your model

from mango impot MangoModel

class GDBeach(MangoModel):
    name: str
    role: str

Initialize ODM and register model

import asyncio
from motor.motor_asyncio import AsyncIOMotorClient
from mango import MangoODM, MangoModel

class GDBeach(MangoModel):
    name: str
    role: str

async def main():

    client = AsyncIOMotorClient("mongodb://localhost:27017") # you also can use srv
    db = client["MangoDB"]
    odm = MangoODM(db)
    odm.register_model(GDBeach)

    async with await client.start_session() as session:

        insert_result = await odm.insert_one("GDBeach", session=session, name="xSodium", role="soda")
        print(f"Inserted document ID: {insert_result.inserted_id}")

        found_doc = await odm.find_one("GDBeach", session=session, name="xSodium")
        print(f"Found document: {found_doc}")

asyncio.run(main())

that's all!

Metadata

Release files for mangodb.py 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for mangodb.py 1.0.0
File Interpreter ABI Platform
mangodb_py-1.0.0-py3-none-any.whl Python 3 none any Details

Release files / mangodb_py-1.0.0-py3-none-any.whl

Download URL mangodb_py-1.0.0-py3-none-any.whl
Size 3.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9fd3eaa3cccd523c38e95a62f2c9c2b317baea9ba76346e2bbe13e7e861a60e8
BLAKE2b-256 checksum
How to use checksums
79817c228a88d598dfad2a755ab8c619077534045dc777930c071af7aed1751b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Security for mangodb.py 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

1.0.0 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page