{"id":23241192,"url":"https://github.com/nikhil-swamix/universaldb","last_synced_at":"2026-05-07T18:40:02.182Z","repository":{"id":213656630,"uuid":"734615081","full_name":"nikhil-swamix/UniversalDB","owner":"nikhil-swamix","description":"New Pythonic Way to interact with MongoDB. perform complex DB operations in one line.","archived":false,"fork":false,"pushed_at":"2024-04-03T14:08:45.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-19T05:08:54.456Z","etag":null,"topics":["django","mongodb","package","pip","python"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/universal-db/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nikhil-swamix.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2023-12-22T06:29:11.000Z","updated_at":"2025-02-07T07:28:35.000Z","dependencies_parsed_at":"2024-04-03T15:29:40.117Z","dependency_job_id":"b7ebd2ca-94fd-4db2-8776-ce24d3452f32","html_url":"https://github.com/nikhil-swamix/UniversalDB","commit_stats":null,"previous_names":["nikhil-software-cartel/universaldb","nikhil-swamix/universaldb"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikhil-swamix%2FUniversalDB","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikhil-swamix%2FUniversalDB/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikhil-swamix%2FUniversalDB/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikhil-swamix%2FUniversalDB/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nikhil-swamix","download_url":"https://codeload.github.com/nikhil-swamix/UniversalDB/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247411265,"owners_count":20934650,"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":["django","mongodb","package","pip","python"],"created_at":"2024-12-19T05:15:49.222Z","updated_at":"2026-05-07T18:40:02.145Z","avatar_url":"https://github.com/nikhil-swamix.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Unified architecture for different DB Vendors \n\n- Manage DB Connections using Just Env Files, auto scan Credentials or use default! `db = udb(\"mongodb\")['movies_app']` explain:` #mongodb=engine, movies_app=db name ` thats it. \n- Database Operations using Operators and Native Syntax! `db['all_movies'] += {'name':'Titanic',...}` explain:` #all_movies=collection name` yes it gets added!\n- utility print function ` db['all_movies'].print(limit=3, reversed=True)`\n- Support Coming soon for : Supabase, Firebase, SQLite, Postgres, ScyllaDB\n\n\n## Getting Started\n\nTo get started with the codebase, follow these steps:\n\n1. Install the necessary dependencies, including `pymongo`, by running the command: `pip install pymongo universal-db` (uploading to pypi repo soon).\n\n2. Import the codebase into your project by including the following import statements:\n\n```python\nimport universaldb as udb\n\nif __name__ == \"__main__\":\n    # ---------- INIT\n    db = udb(\"mongodb://localhost:27017/\")  # use os.env variable in production!\n\n    # ---------- DB-\u003eCollection\n    employees = db[\"test\"]['employees']\n\n    # ---------- ADD DOCUMENT\n    employees += {\"name\": \"nikhil swami\", \"age\": 23, \"gender\": \"male\", \"salary\": 10}\n    print(employees)  # updated\n\n    # ---------- FIND DOCUMENT\n    print(employees[{\"name\": \"nikhil swami\"}])  # returns cursor object which is a generator, can convert to list\n    print(list(employees[{\"age\": {\"$lt\": 25}}]))  # conditions supported just pass dict\n    print(employees[{\"age\": {\"$lt\": 25}}][0])  # slicing supported\n\n    # ---------- ALTERNATIVE PRINT\n    employees.print(limit=3, reversed=True)  #  with limit and reverse, new line per doc\n\n```\n## Features\n\n-   **Native Syntax**: Perform database operations using operators and syntax that closely resemble native MongoDB queries. This allows you to leverage your existing knowledge of\n    MongoDB to work with the codebase effortlessly.\n\n-   **Customizable Plug n Play**: The codebase provides a set of classes - `_Collection`, `_Database`, and `_Client` - that abstract away the complexities of interacting with MongoDB.\n    These classes offer intuitive methods and attributes to access, manipulate, and query your database.\n\n-   **Printing Documents**: Easily print documents from a collection using the `print` method provided by the `_Collection` class. You can specify the number of documents to\n    display and even reverse the order if needed.\n\n-   **Insertion Operator Overload**: The `_Collection` class supports the `+=` operator overload, allowing you to insert documents into a collection with a single line of code.\n    Simply use the `+=` operator with the document you want to insert.\n\n-   **Selector Modes**: The `_Collection` class supports selector modes - \"one\" and \"many\" - to retrieve documents from a collection. This allows you to customize the behavior of\n    document retrieval based on your specific needs.\n\n-   **Database Access**: The `_Database` class enables easy access to collections within a MongoDB database. Simply use the square bracket syntax to retrieve a collection by name.\n\n\n\n# Contributing\n\nContributions to this codebase are welcome! If you encounter any issues, have suggestions for improvements, or want to contribute new features, feel free to open an issue or submit\na pull request on GitHub.\n\n# License\n\nThis codebase is licensed under the MIT License. Feel free to use it in your projects, modify it, and distribute it.\n\n# Contact\n\nIf you have any questions or need further assistance, please don't hesitate to reach out. nikhilswami1@gmail.com\n\n**Important : yet to be published on pypi**\nThis Package  simplifies and gives developer-friendly interface to interact with a MongoDB/supabase database gives you First Class Support perform database operations using operators and native syntax for MongoDB. otherwise they are simply unused. . With its intuitive syntax and powerful features, it aims to make working with databases a breeze. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikhil-swamix%2Funiversaldb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnikhil-swamix%2Funiversaldb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikhil-swamix%2Funiversaldb/lists"}