{"id":13936829,"url":"https://github.com/prashnts/mongocapsule","last_synced_at":"2025-10-08T19:08:30.154Z","repository":{"id":42416845,"uuid":"62129478","full_name":"prashnts/mongocapsule","owner":"prashnts","description":"📦 Encapsulated MongoEngine","archived":false,"fork":false,"pushed_at":"2020-11-03T12:40:45.000Z","size":13,"stargazers_count":19,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-09-12T04:57:10.847Z","etag":null,"topics":["mongodb","mongoengine","orm","python"],"latest_commit_sha":null,"homepage":"","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/prashnts.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-06-28T09:46:20.000Z","updated_at":"2022-04-30T03:12:30.000Z","dependencies_parsed_at":"2022-09-04T22:21:21.079Z","dependency_job_id":null,"html_url":"https://github.com/prashnts/mongocapsule","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/prashnts/mongocapsule","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prashnts%2Fmongocapsule","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prashnts%2Fmongocapsule/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prashnts%2Fmongocapsule/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prashnts%2Fmongocapsule/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/prashnts","download_url":"https://codeload.github.com/prashnts/mongocapsule/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prashnts%2Fmongocapsule/sbom","scorecard":{"id":743913,"data":{"date":"2025-08-11","repo":{"name":"github.com/prashnts/mongocapsule","commit":"f6e4e3539f2b14658698ef4c1bdd23fe075c5e0f"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/13 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.md:0","Info: FSF or OSI recognized license: MIT License: LICENSE.md:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-22T18:13:19.430Z","repository_id":42416845,"created_at":"2025-08-22T18:13:19.430Z","updated_at":"2025-08-22T18:13:19.430Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279000701,"owners_count":26082805,"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","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["mongodb","mongoengine","orm","python"],"created_at":"2024-08-07T23:03:02.128Z","updated_at":"2025-10-08T19:08:30.117Z","avatar_url":"https://github.com/prashnts.png","language":"Python","readme":"# MongoCapsule\n\n[![Build Status](https://img.shields.io/travis/prashnts/mongocapsule/master.svg)](https://travis-ci.org/prashnts/mongocapsule) [![Code Climate](https://img.shields.io/codeclimate/github/prashnts/mongocapsule.svg)](https://codeclimate.com/github/prashnts/mongocapsule) [![Test Coverage](https://img.shields.io/codeclimate/coverage/github/prashnts/mongocapsule.svg)](https://codeclimate.com/github/prashnts/mongocapsule)\n\n[![PyPI](https://img.shields.io/pypi/v/mongocapsule.svg)](https://pypi.python.org/pypi/mongocapsule) [![Requirements Status](https://requires.io/github/prashnts/mongocapsule/requirements.svg?branch=master)](https://requires.io/github/prashnts/mongocapsule/requirements/?branch=master)\n\n## Overview\nMongoCapsule is a very thin wrapper around MongoEngine built for your happiness. It encapsulates MongoEngine attributes under a single namespace and hence allows explicit declaration without context switches.\n\nIn addition to that, MongoCapsule adds pagination support to all the query results.\n\nMongoEngine is a great ORM for using MongoDB in any Python project. However, since MongoEngine works in \"contexts\", using multiple databases requires trickery such as `db_alias` and `switch_db`. MongoCapsule solves this by attaching references to MongoEngine attributes to itself.\n\n\n## Quickstart\n\nIf you are familiar with MongoEngine, you can use MongoCapsule already! Create the database object and use it to define your document and fields.\n\n```python\nfrom mongocapsule import MongoCapsule\n\ndb = MongoCapsule('test_db')\n\nclass Fruits(db.Document):\n    name = db.StringField()\n```\n\nRefer to [MongoEngine Docs](http://docs.mongoengine.org/index.html) for details.\n\n## Installation\n\nTo install use pip:\n\n```bash\n    pip install mongocapsule\n```\n\nOr clone the repo:\n\n```bash\n    git clone https://github.com/prashnts/mongocapsule.git\n    python setup.py install\n```\n\n## Additional API\n\nMongoCapsule adds Pagination support to the MongoEngine `QuerySet` object. It returns 10 objects per page, however, this can be changed.\n\n```python\n\n# Obtain nth Page of any arbitrary query:\n\nquery_results = Document.objects(...).sort(...)\n\nresult_page = query_results.page(2)     # Obtain second page\n\ntotal_pages = query_results.page_count\n\n# Update number of items returned per page:\n\ndb.QuerySet.set_page_limit(20)\n\n```\n\n## Contributing\n\nCode Patches, suggestions and bug reports welcome! Please use GitHub issues for the same.\n\n## Rant\nI wrote this module because the examples in official MongoEngine documentation encourages using `from mongoengine import *` which not only pollutes the local namespace, but makes class definitions implicit. Of course, cherrypicked imports are possible, however that requires a lot of extra imports in each files.\n\nThe biggest problem, however, comes when you're using multiple databases or hosts -- in those cases, you need to use context switches or ugly `meta` attributes in the declaration.\n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprashnts%2Fmongocapsule","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprashnts%2Fmongocapsule","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprashnts%2Fmongocapsule/lists"}