From 372fedab2e806d6a0be20923069aff1145b15e64 Mon Sep 17 00:00:00 2001 From: tarsil Date: Mon, 20 Nov 2023 17:48:50 +0000 Subject: [PATCH 1/2] Fix codecs --- mongoz/core/connection/database.py | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/mongoz/core/connection/database.py b/mongoz/core/connection/database.py index 7ec5411..68fa9c0 100644 --- a/mongoz/core/connection/database.py +++ b/mongoz/core/connection/database.py @@ -1,5 +1,6 @@ -from typing import List +from typing import Any, Dict, List, Optional +from bson import CodecOptions, UuidRepresentation from motor.motor_asyncio import AsyncIOMotorDatabase from mongoz.core.connection.collections import Collection @@ -10,12 +11,27 @@ class Database: MongoDB database object referencing Motor database """ - def __init__(self, name: str, database: AsyncIOMotorDatabase) -> None: + def __init__( + self, + name: str, + database: AsyncIOMotorDatabase, + codec_options: Optional[Dict[str, Any]] = None, + ) -> None: self._db = database self.name = name + self._codec_options = ( + codec_options + if codec_options + else {"uuid_representation": UuidRepresentation.STANDARD} + ) + + @property + def codec_options(self) -> CodecOptions: + return CodecOptions(**self._codec_options) + def get_collection(self, name: str) -> Collection: - collection = self._db.get_collection(name) + collection = self._db.get_collection(name, codec_options=self.codec_options) return Collection(name, collection=collection) async def get_collections(self) -> List[Collection]: From 7f5b7a9280ee8def1bf3bfd2e6a43339e3f7b2e5 Mon Sep 17 00:00:00 2001 From: tarsil Date: Mon, 20 Nov 2023 17:49:10 +0000 Subject: [PATCH 2/2] Update CI --- .github/dependbot.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/dependbot.yml b/.github/dependbot.yml index b9038ca..273ba55 100644 --- a/.github/dependbot.yml +++ b/.github/dependbot.yml @@ -1,10 +1,14 @@ version: 2 updates: - - package-ecosystem: "pip" + - package-ecosystem: "github-actions" directory: "/" schedule: - interval: "monthly" - - package-ecosystem: "github-actions" + interval: "daily" + commit-message: + prefix: ⬆ + - package-ecosystem: "pip" directory: "/" schedule: - interval: monthly + interval: "daily" + commit-message: + prefix: ⬆