Skip to content

Commit

Permalink
Fix codec_options
Browse files Browse the repository at this point in the history
  • Loading branch information
tarsil committed Nov 20, 2023
1 parent 57c03b3 commit 12f36ce
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 7 deletions.
5 changes: 0 additions & 5 deletions mongoz/core/connection/collections.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from bson.binary import UuidRepresentation
from motor.motor_asyncio import AsyncIOMotorCollection


Expand All @@ -10,7 +9,3 @@ class Collection:
def __init__(self, name: str, collection: AsyncIOMotorCollection) -> None:
self._collection: AsyncIOMotorCollection = collection
self.name = name
self.set_uuid_representation(UuidRepresentation.STANDARD)

def set_uuid_representation(self, representation: int) -> None:
self._collection.codec_options.uuid_representation = representation
2 changes: 0 additions & 2 deletions mongoz/core/db/documents/metaclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
no_type_check,
)

from bson import UuidRepresentation
from pydantic._internal._model_construction import ModelMetaclass

from mongoz.core.connection.collections import Collection
Expand Down Expand Up @@ -320,7 +319,6 @@ def __search_for_fields(base: Type, attrs: Any) -> None:

new_class.__db_document__ = True
meta.collection = meta.database.get_collection(collection_name)
meta.collection._collection.codec_options.uuid_representation = UuidRepresentation.STANDARD

mongoz_fields: Dict[str, MongozField] = {}
for field_name, field in new_class.model_fields.items():
Expand Down

0 comments on commit 12f36ce

Please sign in to comment.