{"id":48090185,"url":"https://github.com/nitxiodev/py-mongonnator","last_synced_at":"2026-04-04T15:29:24.670Z","repository":{"id":48970828,"uuid":"278667538","full_name":"nitxiodev/py-mongonnator","owner":"nitxiodev","description":"Just a simple production-ready paginator for Pymongo","archived":false,"fork":false,"pushed_at":"2024-09-03T20:57:10.000Z","size":105,"stargazers_count":6,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-10T23:01:48.241Z","etag":null,"topics":["database","db","mongoclient","mongodb","nosql-database","pagination","pagination-pointer","paginator","production-ready","pymongo","python","python3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nitxiodev.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-07-10T15:20:50.000Z","updated_at":"2024-04-23T16:57:36.000Z","dependencies_parsed_at":"2025-05-10T23:00:37.543Z","dependency_job_id":"76076f9c-3be2-4e92-8b5c-f8d0e5b119d5","html_url":"https://github.com/nitxiodev/py-mongonnator","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/nitxiodev/py-mongonnator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nitxiodev%2Fpy-mongonnator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nitxiodev%2Fpy-mongonnator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nitxiodev%2Fpy-mongonnator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nitxiodev%2Fpy-mongonnator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nitxiodev","download_url":"https://codeload.github.com/nitxiodev/py-mongonnator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nitxiodev%2Fpy-mongonnator/sbom","scorecard":{"id":689453,"data":{"date":"2025-08-11","repo":{"name":"github.com/nitxiodev/py-mongonnator","commit":"72c43f15d43b8dde5984e4d211ca78ce4444d417"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"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":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","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":"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":"Code-Review","score":0,"reason":"Found 0/28 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":"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":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/master.yml:1","Info: no jobLevel write permissions found"],"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":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/master.yml:112: update your workflow using https://app.stepsecurity.io/secureworkflow/nitxiodev/py-mongonnator/master.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/master.yml:117: update your workflow using https://app.stepsecurity.io/secureworkflow/nitxiodev/py-mongonnator/master.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/master.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/nitxiodev/py-mongonnator/master.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/master.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/nitxiodev/py-mongonnator/master.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/master.yml:39: update your workflow using https://app.stepsecurity.io/secureworkflow/nitxiodev/py-mongonnator/master.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/master.yml:42: update your workflow using https://app.stepsecurity.io/secureworkflow/nitxiodev/py-mongonnator/master.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/master.yml:47: update your workflow using https://app.stepsecurity.io/secureworkflow/nitxiodev/py-mongonnator/master.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/master.yml:73: update your workflow using https://app.stepsecurity.io/secureworkflow/nitxiodev/py-mongonnator/master.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/master.yml:76: update your workflow using https://app.stepsecurity.io/secureworkflow/nitxiodev/py-mongonnator/master.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/master.yml:81: update your workflow using https://app.stepsecurity.io/secureworkflow/nitxiodev/py-mongonnator/master.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/master.yml:96: update your workflow using https://app.stepsecurity.io/secureworkflow/nitxiodev/py-mongonnator/master.yml/master?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/master.yml:55","Warn: pipCommand not pinned by hash: .github/workflows/master.yml:89","Warn: pipCommand not pinned by hash: .github/workflows/master.yml:103","Warn: pipCommand not pinned by hash: .github/workflows/master.yml:123","Info:   0 out of  11 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   4 pipCommand dependencies pinned"],"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":"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:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"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"}},{"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":"Vulnerabilities","score":5,"reason":"5 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-3rq5-2g8h-59hc","Warn: Project is vulnerable to: PYSEC-2022-42969","Warn: Project is vulnerable to: GHSA-m87m-mmvp-v9qm","Warn: Project is vulnerable to: PYSEC-2024-187 / GHSA-rqc4-2hc7-8c8v","Warn: Project is vulnerable to: GHSA-jfmj-5v4g-7637"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-22T01:56:30.079Z","repository_id":48970828,"created_at":"2025-08-22T01:56:30.079Z","updated_at":"2025-08-22T01:56:30.079Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31403958,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T10:20:44.708Z","status":"ssl_error","status_checked_at":"2026-04-04T10:20:06.846Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["database","db","mongoclient","mongodb","nosql-database","pagination","pagination-pointer","paginator","production-ready","pymongo","python","python3"],"created_at":"2026-04-04T15:29:24.533Z","updated_at":"2026-04-04T15:29:24.632Z","avatar_url":"https://github.com/nitxiodev.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PyMongonnator ![Build](https://github.com/nitxiodev/py-mongonnator/workflows/Build/badge.svg?branch=master)\nJust a simple production-ready mongo paginator written in Python for [PyMongo](https://github.com/mongodb/mongo-python-driver) package using bucket pattern. This package is based in this wonderful `Javascript` module: [mongo-cursor-pagination](https://www.npmjs.com/package/mongo-cursor-pagination).\nThe reason for making this library was to paginate over thousands of data stored in mongo collections and we didn't find any library that seamlessly integrated with Pymongo.\n\n# Installation\n```bash\npip install PyMongonnator\n```\n### Python version compat\n`PyMongonnator` is compatible with the latest Python3 versions: `3`, `3.5`, `3.6`, `3.7`, `3.8`, `3.9`, `3.10`, `3.11`.\n\n# Usage\n\n`PyMongonnator` exposes two ways to paginate over collections:\n\n- Built-in API importing overriden MongoClient class.\n- Explicit API passing a MongoClient collection into Paginator method.\n\n## Options\n\n- `query`: a SON object specifying elements which must be present for a document to be included in the result set. Default is `{}` (query all).\n- `limit`: Number of documents per page. Default is `75`.\n- `ordering_case`: Ordering sense when retrieving documents from mongo. Valid options are:\n    - `ASCENDING`: Ascending sort order.\n    - `DESCENDING`: Descending sort order (**default**).\n- `ordering_field`: Field to order collections. Default is `_id`.\n- `projection`:  a dict specifying the fields to include or exclude. Please note that the id cannot be excluded because is mandatory in pagination. Default is `{}` (include only the `_id`).\n- `prev_page`: Previous pagination pointer. When no previous page is available, will be None. Default is `None`.\n- `next_page`: Next pagination pointer. When no next page is available, will be None. Default is `None`.\n- `automatic_pagination`: If you want to paginate automatically in batches of `limit` over entire collection. Default is `True`.\n\nWhen options are set, **they should remain unchanged during the whole pagination process** except pagination pointers (prev_page/next_page).\n\n## Built-in API (recommended)\n```python\nfrom mongonator import MongoClientWithPagination, ASCENDING\n\n\nMONGO_URI = 'mongodb://[user]:[password]@[host]:[port]/admin'\nDATABASE = 'database'\nCOLLECTION = 'collection'\n\n# Instantiate mongo client with pagination\nmongo_client = MongoClientWithPagination(MONGO_URI)\ndb = mongo_client[DATABASE]\ncol = db[COLLECTION]\n\nquery_filter = {'name': {'$ne': None}}\n\n\n# Paginate automatically in batches of 5\nfor d in col.paginate(query=query_filter, limit=5, projection={'email': 1, 'name': 1},\n                      ordering_field='name', ordering=ASCENDING):\n    print(d.response)\n    print(d.batch_size)\n\n\n# Paginate manually in batches of 5\npage = col.paginate(query=query_filter, limit=5, projection={'email': 1, 'name': 1},\n                      ordering_field='name', ordering=ASCENDING, automatic_pagination=False)\n\n\n# ahead (next five documents)\nnext_batch_of_five = col.paginate(query=query_filter, limit=5, projection={'email': 1, 'name': 1},\n                      ordering_field='name', ordering=ASCENDING, automatic_pagination=False, next_page=page.next_page)\n\n\n# back (prev five documents from next_batch_of_five situation)\nprev_batch_of_five = col.paginate(query=query_filter, limit=5, projection={'email': 1, 'name': 1},\n                      ordering_field='name', ordering=ASCENDING, automatic_pagination=False, next_page=next_batch_of_five.prev_page)\n```\n\nThis method is intended when you just started a new project from scratch or for existing projects if you are willing to substitute every `MongoClient` instance for `MongoClientWithPagination`.\n\n## Explicit API\n```python\nfrom mongonator import Paginate, ASCENDING\nfrom pymongo import MongoClient\n\n\nMONGO_URI = 'mongodb://[user]:[password]@[host]:[port]/admin'\nDATABASE = 'database'\nCOLLECTION = 'collection'\n\nquery_filter = {'name': {'$ne': None}}\n\n# Instantiate MongoClient from pymongo\nwith MongoClient(MONGO_URI) as mongo_client:\n    db = mongo_client[DATABASE]\n    col = db[COLLECTION]\n\n    # Manual pagination in batches of 2\n    paginator = Paginate(\n        collection=col,\n        query=query_filter,\n        limit=2,\n        ordering_field='email',\n        ordering_case=ASCENDING,\n        projection={'email': 1, 'name': 1},\n        automatic_pagination=False\n    ).paginate()\n\n    # Print results\n    print(\"Response: \", paginator.response)\n    print(\"Prev page: \", paginator.prev_page)\n    print(\"Next page: \", paginator.next_page)\n    print(\"Batch size: \", paginator.batch_size)\n\n    # Manual pagination for two next results...\n    paginator = Paginate(\n        collection=col,\n        query=query_filter,\n        limit=2,\n        ordering_field='email',\n        ordering_case=ASCENDING,\n        projection={'email': 1, 'name': 1},\n        automatic_pagination=False,\n        next_page=paginator.next_page,\n    ).paginate()\n\n    # Print results\n    print(\"Response: \", paginator.response)\n    print(\"Prev page: \", paginator.prev_page)\n    print(\"Next page: \", paginator.next_page)\n    print(\"Batch size: \", paginator.batch_size)\n\n    # ... Or simply use automatic pagination in batches of 2 (starting in first document)\n    for d in Paginate(\n        collection=col,\n        query=query_filter,\n        limit=2,\n        ordering_field='email',\n        ordering_case=ASCENDING,\n        projection={'email': 1, 'name': 1},\n        automatic_pagination=True,\n    ).paginate():\n        print(d.response)\n```\n\nThis method is intended when you have a big project in production and is not possible to substitute every [MongoClient](https://api.mongodb.com/python/current/api/pymongo/mongo_client.html#pymongo.mongo_client.MongoClient) call.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnitxiodev%2Fpy-mongonnator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnitxiodev%2Fpy-mongonnator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnitxiodev%2Fpy-mongonnator/lists"}