MongoX is an async python ODM for MongoDB which is built on top Motor and Pydantic.

Overview

Build Status Publish Status Coverage Package version


MongoX

MongoX is an async python ODM (Object Document Mapper) for MongoDB which is built on top Motor and Pydantic.

The main features include:

  • Fully type annotated
  • Async support Python 3.7+ (since it's built on top of Motor)
  • Elegant editor support (since it's built on top of Pydantic)
  • Autocompletion everywhere, from object creation to query results
  • Custom query builder which is more intuitive and pythonic
  • 100% test coverage

MongoX models are at the same time Pydantic models and have the same functionalitties, so you can use them with your existing Pydantic models.


Documentation: https://aminalaee.github.io/mongox


Installation

$ pip install mongox

Quickstart

You can define mongox models the same way you define Pydantic models. The difference is they should inherit from mongox.Model now:

import asyncio

import mongox

client = mongox.Client(
    "mongodb://localhost:27017", get_event_loop=asyncio.get_running_loop
)
db = client.get_database("test_db")


class Movie(mongox.Model):
    name: str
    year: int

    class Meta:
        collection = db.get_collection("movies")

Now you can create some instances and insert them into the database:

movie = await Movie(name="Forrest Gump", year=1994).insert()

The returned result will be a Movie instance, and mypy will understand that this is a Movie instance. So you will have type hints and validations everywhere:

MongoX insert screenshot

Now you can fetch some data from the database.

You can use the same pattern as PyMongo/Motor:

movie = await Movie.query({"name": "Forrest Gump"}).get()

The returned result will be a Movie instance, and mypy will understand that this is a Movie instance.

This will have great IDE support, autocompletion and validation.

MongoX get screenshot

Or you can use Movie fields instead of dictionaries in the query (less room for bugs):

movie = await Movie.query({Movie.name: "Forrest Gump"}).get()

And finally you can use a more intuitive query (limited yet):

movie = await Movie.query(Movie.name == "Forrest Gump").get()

Notice how we omitted the dictionary and passed the Movie fields in comparison.


Please refer to the documentation here or the full examples here.


Comments
  • Possible error in the return of the update method

    Possible error in the return of the update method

    I have been creating the update_or_create method based on the get_or_create and update methods, doing some tests I found a possible bug in the update method.

    in the database I have the following data.

    [
      {
        "name": "Venom",
        "year": 2023
      },{
        "name": "Venom2",
        "year": 2021
      }
    ]
    

    and when executing the next query Movie.query({Movie.name: "Venom"}).update({Movie.year: 2021}), what I would expect is for the method to return

    [
      {
        "name": "Venom",
        "year": 2021
      }
    ]
    

    But what it returns is

    [
      {
        "name": "Venom",
        "year": 2021
      },{
        "name": "Venom2",
        "year": 2021
      }
    ]
    

    Is this a bug or is expected to happen?

    bug 
    opened by MAD-py 16
  • Querying inside lists

    Querying inside lists

    Need tests and probably fixes for querying inside a List field:

    import mongox
    
    
    class Movie(mongox.Model):
        name: str
        year: int
       tags: List[str]
    

    Need to be able to query inside the tags fields. Maybe like this:

    await Movie.query(Movie.tags == ["A", "B"])
    
    await Movie.query(Q.contains(Movie.tags, ["A", "B"]))
    

    Any feedback would be appreciated.

    enhancement 
    opened by aminalaee 15
  • Get or Create method

    Get or Create method

    add get_or_create:

    class Movie(mongox.Model):
        name: str
        year: int
    
        class Meta:
            collection = db.get_collection("movies")
    
    movie = await Movie.query({Movie.name: "Forrest Gump"}).get_or_create({Movie.year: 2003})
    assert movie.name == "Forrest Gump"
    assert movie.year == 2003
    
    • [x] docs
    • [x] test
    opened by MAD-py 14
  • Correction of the bug in the return of the update

    Correction of the bug in the return of the update

    Hey @aminalaee,

    This would be the solution to bug #27, I still have to update the documentation but first I would like to know what do you think about the solution?

    opened by MAD-py 8
  • Removing Meta class from Model definition

    Removing Meta class from Model definition

    As it was suggested in #4, I think it would be nice to remove the Meta class, at least from the documentation but it will still work if defined:

    class Movie(Model, db=db, collection="movies"):
        name: str
        year: int
    

    Instead of:

    class Movie(mongox.Model):
        name: str
        year: int
    
        class Meta:
            collection = db.get_collection("movies")
    

    We could also remove db and accept Collection instances, but I think this will be easier.

    Update: Ass suggested by @MAD-py we the db argument will be required and the collection will be <class_name>s if not provided.

    opened by aminalaee 7
  • maybe can provide Model.get() function for get obj by id?

    maybe can provide Model.get() function for get obj by id?

    Although we can use Model.query({"_id": id}).first() to get object by id,But maybe it's better to use a shotcut function like:

    Model.get("id")
    
    opened by ischaojie 4
  • Bump starlette from 0.20.1 to 0.21.0

    Bump starlette from 0.20.1 to 0.21.0

    Bumps starlette from 0.20.1 to 0.21.0.

    Release notes

    Sourced from starlette's releases.

    Version 0.21.0

    This release replaces the underlying HTTP client used on the TestClient (requests :arrow_right: httpx), and as those clients differ a bit on their API, your test suite will likely break. To make the migration smoother, you can use the bump-testclient tool.

    Changed

    • Replace requests with httpx in TestClient #1376.

    Added

    • Add WebSocketException and support for WebSocket exception handlers #1263.
    • Add middleware parameter to Mount class #1649.
    • Officially support Python 3.11 1863.
    • Implement __repr__ for route classes #1864.

    Fixed

    • Fix bug on which BackgroundTasks were cancelled when using BaseHTTPMiddleware and client disconnected #1715.

    Version 0.20.4

    Fixed

    • Remove converter from path when generating OpenAPI schema #1648.

    Version 0.20.3

    Fixed

    • Revert "Allow StaticFiles to follow symlinks" #1681.

    Version 0.20.2

    Fixed

    • Fix regression on route paths with colons #1675.
    • Allow StaticFiles to follow symlinks #1337.
    Changelog

    Sourced from starlette's changelog.

    0.21.0

    September 26, 2022

    This release replaces the underlying HTTP client used on the TestClient (requests :arrow_right: httpx), and as those clients differ a bit on their API, your test suite will likely break. To make the migration smoother, you can use the bump-testclient tool.

    Changed

    • Replace requests with httpx in TestClient #1376.

    Added

    • Add WebSocketException and support for WebSocket exception handlers #1263.
    • Add middleware parameter to Mount class #1649.
    • Officially support Python 3.11 1863.
    • Implement __repr__ for route classes #1864.

    Fixed

    • Fix bug on which BackgroundTasks were cancelled when using BaseHTTPMiddleware and client disconnected #1715.

    0.20.4

    June 28, 2022

    Fixed

    • Remove converter from path when generating OpenAPI schema #1648.

    0.20.3

    June 10, 2022

    Fixed

    • Revert "Allow StaticFiles to follow symlinks" #1681.

    0.20.2

    June 7, 2022

    Fixed

    • Fix regression on route paths with colons #1675.
    • Allow StaticFiles to follow symlinks #1337.
    Commits
    • 0b8a775 Version 0.21.0 (#1812)
    • 040d8c8 Replace task cancellation in BaseHTTPMiddleware with http.disconnect+`rec...
    • 70971ea Implement repr for route classes (#1864)
    • e89e131 Add official support for Python 3.11 (#1863)
    • ef34ece Add Mount(..., middleware=[...]) (#1649)
    • bc61505 Add Starlette-Admin to third party package section (#1853)
    • 6765502 Replace HTTP client on TestClient from requests to httpx (#1376)
    • 243d03e Remove reference to DatabaseMiddleware in the documentation (#1845)
    • d525431 Add WebSocketException and support for WS handlers (#1263)
    • 9386bcf Add missing Middleware import on BaseHTTPMiddleware section (#1844)
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 3
  • Bump starlette from 0.19.0 to 0.19.1

    Bump starlette from 0.19.0 to 0.19.1

    Bumps starlette from 0.19.0 to 0.19.1.

    Release notes

    Sourced from starlette's releases.

    Version 0.19.1

    Fixed

    • Fix inference of Route.name when created from methods #1553.
    • Avoid TypeError on websocket.disconnect when code is None #1574.

    Deprecated

    • Deprecate WS_1004_NO_STATUS_RCVD and WS_1005_ABNORMAL_CLOSURE in favor of WS_1005_NO_STATUS_RCVD and WS_1006_ABNORMAL_CLOSURE, as the previous constants didn't match the WebSockets specs #1580.
    Changelog

    Sourced from starlette's changelog.

    0.19.1

    April 22, 2022

    Fixed

    • Fix inference of Route.name when created from methods #1553.
    • Avoid TypeError on websocket.disconnect when code is None #1574.

    Deprecated

    • Deprecate WS_1004_NO_STATUS_RCVD and WS_1005_ABNORMAL_CLOSURE in favor of WS_1005_NO_STATUS_RCVD and WS_1006_ABNORMAL_CLOSURE, as the previous constants didn't match the WebSockets specs #1580.
    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 3
  • Insert isn't working

    Insert isn't working

    My class class Minutedsx(mongox.Model, db=db, indexes=ohlcindx): tradingsymbol: str date: datetime open: float high: float low: float close: float

    class Meta:
        collection = db.get_collection("mindsx")
    

    I import it in another class and tried insert in loop. but nothing gets inserted. tried the basic.py in example folder that also didnt insert anything. DB was created though.

    opened by crealityeducation 3
  • Version 0.1.0

    Version 0.1.0

    What's Changed

    Added

    • get_or_create method by @MAD-py in https://github.com/aminalaee/mongox/pull/23
    • Avoid Meta class from Model definition by @aminalaee in https://github.com/aminalaee/mongox/pull/25
    • Fix bulk update return by @MAD-py in https://github.com/aminalaee/mongox/pull/29

    Internal

    • Fixed autouse fixtures by @kuutsav in https://github.com/aminalaee/mongox/pull/26

    New Contributors

    • @MAD-py made their first contribution in https://github.com/aminalaee/mongox/pull/21
    • @kuutsav made their first contribution in https://github.com/aminalaee/mongox/pull/26

    Full Changelog: https://github.com/aminalaee/mongox/compare/0.0.3...0.1.0

    opened by aminalaee 3
  • Fixed autouse fixtures

    Fixed autouse fixtures

    @aminalaee autouse fixutres were getting called at the beginning of each test rather than the end which was leading to test_db not being empty at the end

    Movie.query().all() returned this earlier

    [Movie(id=ObjectId('61ed0cd87f46c40b190810e6'), name='Forrest Gump', year=2003, uuid=None),
     Movie(id=ObjectId('61ed0cd87f46c40b190810e9'), name='Venom', year=2021, uuid=None),
     Movie(id=ObjectId('61ed0cd87f46c40b190810eb'), name='Eternals', year=2021, uuid=None)]
    
    opened by kuutsav 3
  • Bump pydantic from 1.9.1 to 1.10.4

    Bump pydantic from 1.9.1 to 1.10.4

    Bumps pydantic from 1.9.1 to 1.10.4.

    Release notes

    Sourced from pydantic's releases.

    v1.10.4 (2022-12-30)

    Full Changelog: https://github.com/pydantic/pydantic/compare/v1.10.3...v1.10.4

    v1.10.3 (2022-12-29)

    Full Changelog: https://github.com/pydantic/pydantic/compare/v1.10.2...v1.10.3

    v1.10.2 (2022-09-05)

    Full Changelog: https://github.com/pydantic/pydantic/compare/v1.10.1...v1.10.2

    v1.10.1 (2022-08-31)

    • Add __hash__ method to pydancic.color.Color class, #4454 by @​czaki

    Full Changelog: https://github.com/pydantic/pydantic/compare/v1.10.0...v1.10.1

    v1.10.0 (2022-08-30)

    See #4419 for feedback and discussion, docs are live at pydantic-docs.helpmanual.io.

    • Refactor the whole pydantic dataclass decorator to really act like its standard lib equivalent. It hence keeps __eq__, __hash__, ... and makes comparison with its non-validated version possible. It also fixes usage of frozen dataclasses in fields and usage of default_factory in nested dataclasses. The support of Config.extra has been added. Finally, config customization directly via a dict is now possible, #2557 by @​PrettyWood BREAKING CHANGES:
      • The compiled boolean (whether pydantic is compiled with cython) has been moved from main.py to version.py
      • Now that Config.extra is supported, dataclass ignores by default extra arguments (like BaseModel)

    ... (truncated)

    Changelog

    Sourced from pydantic's changelog.

    v1.10.4 (2022-12-30)

    v1.10.3 (2022-12-29)

    NOTE: v1.10.3 was "yanked" from PyPI due to #4885 which is fixed in v1.10.4

    v1.10.2 (2022-09-05)

    v1.10.1 (2022-08-31)

    • Add __hash__ method to pydancic.color.Color class, #4454 by @​czaki

    v1.10.0 (2022-08-30)

    • Refactor the whole pydantic dataclass decorator to really act like its standard lib equivalent. It hence keeps __eq__, __hash__, ... and makes comparison with its non-validated version possible. It also fixes usage of frozen dataclasses in fields and usage of default_factory in nested dataclasses. The support of Config.extra has been added. Finally, config customization directly via a dict is now possible, #2557 by @​PrettyWood BREAKING CHANGES:
      • The compiled boolean (whether pydantic is compiled with cython) has been moved from main.py to version.py
      • Now that Config.extra is supported, dataclass ignores by default extra arguments (like BaseModel)
    • Fix PEP487 __set_name__ protocol in BaseModel for PrivateAttrs, #4407 by @​tlambert03
    • Allow for custom parsing of environment variables via parse_env_var in Config, #4406 by @​acmiyaguchi

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 0
  • Bump pytest-asyncio from 0.18.3 to 0.20.3

    Bump pytest-asyncio from 0.18.3 to 0.20.3

    Bumps pytest-asyncio from 0.18.3 to 0.20.3.

    Release notes

    Sourced from pytest-asyncio's releases.

    pytest-asyncio 0.20.3


    title: 'pytest-asyncio'

    image

    image

    image

    Supported Python versions

    image

    pytest-asyncio is a pytest plugin. It facilitates testing of code that uses the asyncio library.

    Specifically, pytest-asyncio provides support for coroutines as test functions. This allows users to await code inside their tests. For example, the following code is executed as a test item by pytest:

    @pytest.mark.asyncio
    async def test_some_asyncio_code():
        res = await library.do_something()
        assert b"expected result" == res
    

    Note that test classes subclassing the standard unittest library are not supported. Users are advised to use unittest.IsolatedAsyncioTestCase or an async framework such as asynctest.

    pytest-asyncio is available under the Apache License 2.0.

    Installation

    To install pytest-asyncio, simply:

    $ pip install pytest-asyncio
    

    ... (truncated)

    Changelog

    Sourced from pytest-asyncio's changelog.

    0.20.3 (22-12-08)

    • Prevent DeprecationWarning to bubble up on CPython 3.10.9 and 3.11.1. [#460](https://github.com/pytest-dev/pytest-asyncio/issues/460) <https://github.com/pytest-dev/pytest-asyncio/issues/460>_

    0.20.2 (22-11-11)

    • Fixes an issue with async fixtures that are defined as methods on a test class not being rebound to the actual test instance. [#197](https://github.com/pytest-dev/pytest-asyncio/issues/197) <https://github.com/pytest-dev/pytest-asyncio/issues/197>_
    • Replaced usage of deprecated @pytest.mark.tryfirst with @pytest.hookimpl(tryfirst=True) [#438](https://github.com/pytest-dev/pytest-asyncio/issues/438) <https://github.com/pytest-dev/pytest-asyncio/pull/438>_

    0.20.1 (22-10-21)

    • Fixes an issue that warned about using an old version of pytest, even though the most recent version was installed. [#430](https://github.com/pytest-dev/pytest-asyncio/issues/430) <https://github.com/pytest-dev/pytest-asyncio/issues/430>_

    0.20.0 (22-10-21)

    • BREAKING: Removed legacy mode. If you're upgrading from v0.19 and you haven't configured asyncio_mode = legacy, you can upgrade without taking any additional action. If you're upgrading from an earlier version or you have explicitly enabled legacy mode, you need to switch to auto or strict mode before upgrading to this version.
    • Deprecate use of pytest v6.
    • Fixed an issue which prevented fixture setup from being cached. [#404](https://github.com/pytest-dev/pytest-asyncio/issues/404) <https://github.com/pytest-dev/pytest-asyncio/pull/404>_

    0.19.0 (22-07-13)

    • BREAKING: The default asyncio_mode is now strict. [#293](https://github.com/pytest-dev/pytest-asyncio/issues/293) <https://github.com/pytest-dev/pytest-asyncio/issues/293>_
    • Removes setup.py since all relevant configuration is present setup.cfg. Users requiring an editable installation of pytest-asyncio need to use pip v21.1 or newer. [#283](https://github.com/pytest-dev/pytest-asyncio/issues/283) <https://github.com/pytest-dev/pytest-asyncio/issues/283>_
    • Declare support for Python 3.11.
    Commits
    • 007e8ec [fix] Prevent DeprecationWarning about existing event loops to bubble up into...
    • 44ca3da Build(deps): Bump zipp from 3.10.0 to 3.11.0 in /dependencies/default (#455)
    • c3c601c Build(deps): Bump pypa/gh-action-pypi-publish from 1.5.1 to 1.5.2 (#456)
    • a962e2b Build(deps): Bump importlib-metadata in /dependencies/default (#454)
    • 56a393a Simplify README, move most content to a separate user documentation. (#448)
    • 3c78732 Build(deps): Bump hypothesis in /dependencies/default (#453)
    • d6a9a72 Build(deps): Bump exceptiongroup in /dependencies/default (#451)
    • 42da7a0 Build(deps): Bump hypothesis in /dependencies/default (#450)
    • 0b281b1 Build(deps): Bump mypy from 0.990 to 0.991 in /dependencies/default (#446)
    • d39589c Update pre-commit hooks (#449)
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 0
  • Bump mypy from 0.971 to 0.991

    Bump mypy from 0.971 to 0.991

    Bumps mypy from 0.971 to 0.991.

    Commits
    • b7788fc Update version to remove "+dev" for releasing 0.991
    • 6077d19 manually CP typeshed #9130
    • ab0ea1e Fix crash with function redefinition (#14064)
    • 592a9ce Fix another crash with report generation on namespace packages (#14063)
    • 1650ae0 Update --no-warn-no-return docs for empty body changes (#14065)
    • b9daa31 Don't ignore errors in files passed on the command line (#14060)
    • 02fd8a5 Filter out wasm32 wheel in upload-pypi.py (#14035)
    • 131c8d7 Fix crash on inference with recursive alias to recursive instance (#14038)
    • 1368338 Change version to 0.991+dev in preparation for the point release
    • b71dc3d Remove +dev from version
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 0
  • Bump mkautodoc from 0.1.0 to 0.2.0

    Bump mkautodoc from 0.1.0 to 0.2.0

    Bumps mkautodoc from 0.1.0 to 0.2.0.

    Commits
    • ad41abc Merge pull request #34 from Kludex/bump-mkautodoc
    • f5c69d7 Update setup.py
    • 7dcc6fb Version 0.2.0
    • 7807afb Merge pull request #18 from AnjoMan/readible-test-expectations
    • 1ae0daf Refactor tests for readible output
    • 01713b0 Merge pull request #11 from RealOrangeOne/patch-1
    • dd6d368 Correct repo URL
    • 748d424 Merge pull request #6 from florimondmanca/feat/async-marker
    • b9b5b60 Merge pull request #5 from florimondmanca/patch-1
    • 7073c1f Merge pull request #4 from florimondmanca/upgrade-pip
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 0
  • Bump autoflake from 1.4 to 1.7.8

    Bump autoflake from 1.4 to 1.7.8

    Bumps autoflake from 1.4 to 1.7.8.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 0
  • Error when working with multiple models

    Error when working with multiple models

    When working with 2 different models, it seems like mongox is ignoring the collection name and inserting into the first one's collection.

    Currently, I have 2 models defined in 2 different files:

    class UserAction(mongox.Model, db=db, collection="user_actions"):
        server_id: int
        name: str
        aliases: list[str]
        emoji: str
        self_text: str
        receivers_text: list[str]
    
    class ServerSetting(mongox.Model, db=db, collection="server_settings"):
        server_id: int
        ignored_channels: list[int]
    

    Firstly, I insert into server_settings, but when I try to insert into user_actions, the object gets created inside the server_settings collection instead.

    opened by macthetoaster 1
Releases(0.1.2)
  • 0.1.2(Nov 9, 2022)

    What's Changed

    • For each Modelclass a new Meta instance will be created by @lgln-kmi in https://github.com/aminalaee/mongox/pull/90
    • Fix QuickStart sample error in documentation by @A-kirami in https://github.com/aminalaee/mongox/pull/82

    New Contributors

    • @A-kirami made their first contribution in https://github.com/aminalaee/mongox/pull/82
    • @lgln-kmi made their first contribution in https://github.com/aminalaee/mongox/pull/90

    Full Changelog: https://github.com/aminalaee/mongox/compare/0.1.1...0.2.0

    Source code(tar.gz)
    Source code(zip)
  • 0.1.1(Jul 28, 2022)

    Version 0.1.1

    Added

    • Add Pydantic validation to get_or_create method by @MAD-py in https://github.com/aminalaee/mongox/pull/34
    • Expose Async Generator in Queryset by @aminalaee in https://github.com/aminalaee/mongox/pull/38
    • add get_by_id method by @ischaojie in https://github.com/aminalaee/mongox/pull/37
    • Add Q method contains for lists and strings by @MAD-py in https://github.com/aminalaee/mongox/pull/39
    • Add Q method regex for matched strings by @MAD-py in https://github.com/aminalaee/mongox/pull/45
    • Add insert_many method by @ischaojie in https://github.com/aminalaee/mongox/pull/48

    Fixed

    • Fix spelling mistake and some by @ischaojie in https://github.com/aminalaee/mongox/pull/40

    Full Changelog: https://github.com/aminalaee/mongox/compare/0.1.0...0.1.1

    Source code(tar.gz)
    Source code(zip)
  • 0.1.0(Jan 30, 2022)

    What's Changed

    Added

    • get_or_create method by @MAD-py in https://github.com/aminalaee/mongox/pull/23
    • Avoid Meta class from Model definition by @aminalaee in https://github.com/aminalaee/mongox/pull/25
    • Fix bulk update return by @MAD-py in https://github.com/aminalaee/mongox/pull/29

    Internal

    • Fixed autouse fixtures by @kuutsav in https://github.com/aminalaee/mongox/pull/26

    New Contributors

    • @MAD-py made their first contribution in https://github.com/aminalaee/mongox/pull/21
    • @kuutsav made their first contribution in https://github.com/aminalaee/mongox/pull/26

    Full Changelog: https://github.com/aminalaee/mongox/compare/0.0.3...0.1.0

    Source code(tar.gz)
    Source code(zip)
  • 0.0.3(Dec 6, 2021)

    What's Changed

    • Add EmbeddedModel in https://github.com/aminalaee/mongox/pull/15
    • Set Client default event loop in https://github.com/aminalaee/mongox/pull/17
    • Starlette integration tests in https://github.com/aminalaee/mongox/pull/19

    Full Changelog: https://github.com/aminalaee/mongox/compare/0.0.2...0.0.3

    Source code(tar.gz)
    Source code(zip)
  • 0.0.2(Nov 22, 2021)

    What's Changed

    Added

    • Add create_indexfor single index in https://github.com/aminalaee/mongox/pull/12
    • Add drop_index and drop_indexes methods in https://github.com/aminalaee/mongox/pull/11
    • Introduce QueryExpression and SortExpression in https://github.com/aminalaee/mongox/pull/5
    • Refactor query expression by @yezz123 in https://github.com/aminalaee/mongox/pull/6
    • Add field-level customization docs in https://github.com/aminalaee/mongox/pull/7
    • Extended Q operator in https://github.com/aminalaee/mongox/pull/8
    • Add Index and Q docs in https://github.com/aminalaee/mongox/pull/9

    Fixed

    • remove repeated import in example by @ischaojie in https://github.com/aminalaee/mongox/pull/3

    New Contributors

    • @ischaojie made their first contribution in https://github.com/aminalaee/mongox/pull/3
    • @yezz123 made their first contribution in https://github.com/aminalaee/mongox/pull/6

    Full Changelog: https://github.com/aminalaee/mongox/compare/0.0.1...0.0.2

    Source code(tar.gz)
    Source code(zip)
Owner
Amin Alaee
Software engineer, Python enthusiast
Amin Alaee
sync/async MongoDB ODM, yes.

μMongo: sync/async ODM μMongo is a Python MongoDB ODM. It inception comes from two needs: the lack of async ODM and the difficulty to do document (un)

Scille 428 Dec 29, 2022
Motor - the async Python driver for MongoDB and Tornado or asyncio

Motor Info: Motor is a full-featured, non-blocking MongoDB driver for Python Tornado and asyncio applications. Documentation: Available at motor.readt

mongodb 2.1k Dec 26, 2022
Motor - the async Python driver for MongoDB and Tornado or asyncio

Motor Info: Motor is a full-featured, non-blocking MongoDB driver for Python Tornado and asyncio applications. Documentation: Available at motor.readt

mongodb 1.6k Feb 6, 2021
Micro ODM for MongoDB

Beanie - is an asynchronous ODM for MongoDB, based on Motor and Pydantic. It uses an abstraction over Pydantic models and Motor collections to work wi

Roman 993 Jan 3, 2023
MongoDB data stream pipeline tools by YouGov (adopted from MongoDB)

mongo-connector The mongo-connector project originated as a MongoDB mongo-labs project and is now community-maintained under the custody of YouGov, Pl

YouGov 1.9k Jan 4, 2023
CouchDB client built on top of aiohttp (asyncio)

aiocouchdb source: https://github.com/aio-libs/aiocouchdb documentation: http://aiocouchdb.readthedocs.org/en/latest/ license: BSD CouchDB client buil

aio-libs 53 Apr 5, 2022
PyMongo - the Python driver for MongoDB

PyMongo Info: See the mongo site for more information. See GitHub for the latest source. Documentation: Available at pymongo.readthedocs.io Author: Mi

mongodb 3.7k Jan 8, 2023
A Python Object-Document-Mapper for working with MongoDB

MongoEngine Info: MongoEngine is an ORM-like layer on top of PyMongo. Repository: https://github.com/MongoEngine/mongoengine Author: Harry Marr (http:

MongoEngine 3.9k Jan 8, 2023
Monty, Mongo tinified. MongoDB implemented in Python !

Monty, Mongo tinified. MongoDB implemented in Python ! Inspired by TinyDB and it's extension TinyMongo. MontyDB is: A tiny version of MongoDB, against

David Lai 522 Jan 1, 2023
A simple password manager I typed with python using MongoDB .

Python with MongoDB A simple python code example using MongoDB. How do i run this code • First of all you need to have a python on your computer. If y

null 31 Dec 6, 2022
Implementing basic MongoDB CRUD (Create, Read, Update, Delete) queries, using Python.

MongoDB with Python Implementing basic MongoDB CRUD (Create, Read, Update, Delete) queries, using Python. We can connect to a MongoDB database hosted

MousamSingh 4 Dec 1, 2021
A CRUD and REST api with mongodb atlas.

Movies_api A CRUD and REST api with mongodb atlas. Setup First import all the python dependencies in your virtual environment or globally by the follo

Pratyush Kongalla 0 Nov 9, 2022
A Pythonic, object-oriented interface for working with MongoDB.

PyMODM MongoDB has paused the development of PyMODM. If there are any users who want to take over and maintain this project, or if you just have quest

mongodb 345 Dec 25, 2022
A simple wrapper to make a flat file drop in raplacement for mongodb out of TinyDB

Purpose A simple wrapper to make a drop in replacement for mongodb out of tinydb. This module is an attempt to add an interface familiar to those curr

null 180 Jan 1, 2023
Query multiple mongoDB database collections easily

leakscoop Perform queries across multiple MongoDB databases and collections, where the field names and the field content structure in each database ma

bagel 5 Jun 24, 2021
Async database support for Python. 🗄

Databases Databases gives you simple asyncio support for a range of databases. It allows you to make queries using the powerful SQLAlchemy Core expres

Encode 3.2k Dec 30, 2022
Async ORM based on PyPika

PyPika-ORM - ORM for PyPika SQL Query Builder The package gives you ORM for PyPika with asycio support for a range of databases (SQLite, PostgreSQL, M

Kirill Klenov 7 Jun 4, 2022
Familiar asyncio ORM for python, built with relations in mind

Tortoise ORM Introduction Tortoise ORM is an easy-to-use asyncio ORM (Object Relational Mapper) inspired by Django. Tortoise ORM was build with relati

Tortoise 3.3k Dec 31, 2022
Apache Libcloud is a Python library which hides differences between different cloud provider APIs and allows you to manage different cloud resources through a unified and easy to use API

Apache Libcloud - a unified interface for the cloud Apache Libcloud is a Python library which hides differences between different cloud provider APIs

The Apache Software Foundation 1.9k Dec 25, 2022