{"id":18669196,"url":"https://github.com/danbradham/mongoom","last_synced_at":"2025-11-06T17:30:32.365Z","repository":{"id":13588199,"uuid":"16280928","full_name":"danbradham/mongoom","owner":"danbradham","description":"A Mongo ODM for python.","archived":false,"fork":false,"pushed_at":"2021-12-11T14:37:55.000Z","size":80,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-12-27T18:43:51.431Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danbradham.png","metadata":{"files":{"readme":"README.rst","changelog":null,"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":"2014-01-27T14:13:25.000Z","updated_at":"2014-02-17T04:34:26.000Z","dependencies_parsed_at":"2022-08-30T20:22:15.501Z","dependency_job_id":null,"html_url":"https://github.com/danbradham/mongoom","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/danbradham%2Fmongoom","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danbradham%2Fmongoom/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danbradham%2Fmongoom/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danbradham%2Fmongoom/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danbradham","download_url":"https://codeload.github.com/danbradham/mongoom/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239499803,"owners_count":19649109,"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-11-07T08:46:12.878Z","updated_at":"2025-11-06T17:30:32.330Z","avatar_url":"https://github.com/danbradham.png","language":"Python","readme":"Mongoom\n=======\n\nRelease v0.1.1.\n\nStay Pythonic while working with MongoDB. Mongoom provides a light-weight api for mapping MongoDB documents to Python objects on top of pymongo.\n\nFeatures\n========\n\n- Encoding and Decoding of documents.\n- Active Validation\n- Document based Events\n- Threaded Subscriber\n\n\nUsing Mongoom is simple!\n========================\n\nInherit from Document and EmbeddedDocument to define a schema.\n\n::\n\n    from mongoom import *\n\n\n    class User(Document):\n        name = Field(basestring, required=True)\n        last_name = Field(basestring, required=True)\n\n\n    class Comment(EmbeddedDocument):\n        user = Field(User, required=True)\n        text = Field(basestring, required=True)\n        created = Field(datetime, default=datetime.utcnow)\n\n\n    class Project(Document):\n        name = Field(basestring, required=True)\n        user = Field(User, required=True)\n        created = Field(datetime, default=datetime.utcnow)\n        description = Field(basestring)\n        comments = ListField(Comment)\n\n\nEstablish a connection and save some documents.\n\n::\n\n    connect(\"test_db\", \"localhost\", 27017)\n\n    edison = User(\n        name=\"Thomas\",\n        last_name=\"Edison\",\n        ).save()\n\n    bulb = Project(\n        name=\"Light Bulb\",\n        user=edison,\n        description=\"Create a commercially viable light bulb.\",\n        ).save()\n\n    naysayer = User(\n        name=\"Anonymous\",\n        last_name=\"Naysayer\",\n        ).save()\n\n    rude_comment = Comment(\n        user=naysayer,\n        text=(\"It's impossible to create a viable light bulb. Like all of\"\n              \"Mr. Edison's ideas, this too will be proven impractical.\"),\n        )\n\n    bulb.comments.append(rude_comment)\n    bulb.save()\n\n\nRetrieve and modify a Document.\n\n::\n\n    bulb = Project.find_one(name=\"Light Bulb\")\n    edison = User.find_one(last_name=\"Edison\")\n    rebutt = Comment(\n        user=edison,\n        text=\"I'll show you!\")\n    bulb.comments.append(rebutt)\n    bulb.save()\n\n\nAlso included with Mongoom is an Event and Subscriber. Event objects are nothing more than a Document object residing in a capped collection. While subscribers are tailable cursors awaiting data to be entered into a capped collection. Using these two objects we can easily create a simple event handling system:\n\n::\n\n    from mongoom *\n\n    class Create(Event):\n        '''Create Event'''\n\n    class EventHandler(Subscriber):\n        def handle(self, document):\n            print document\n            print document.ref.data\n\n    connect(\"test_db\")\n\n    fire(Event)  # Fire a blank Event to initialize capped collection\n\n    regret = Comment(\n        user=User.find_one(name=\"naysayer\"),\n        text=\"I feel like an idiot, the light bulb turned out great.\"\n        )\n    bulb = Project.find_one(name=\"Light Bulb\")\n    bulb.append(regret)\n    bulb.save()\n    fire(Create, ref=idiot)\n\n    ev_handler = EventHandler(\"Event\")\n    ev_handler.start()\n\n\nFor a more elaborate mongorm event-driven system check out EventSubscriber.py in examples.\n\nInstallation\n============\n\n::\n\n    git clone https://github.com/danbradham/mongoom.git\n    cd mongoom\n    python setup.py install\n\nDocumentation\n=============\nVisit http://mongoom.readthedocs.org for full documentation.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanbradham%2Fmongoom","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanbradham%2Fmongoom","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanbradham%2Fmongoom/lists"}