From 8ca6d13719041ece9f23c7ac25a117604438facd Mon Sep 17 00:00:00 2001 From: Ryu-CZ Date: Wed, 10 May 2023 10:31:11 +0200 Subject: [PATCH] fix: default collection data insert --- src/mongomancy/schema.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/mongomancy/schema.py b/src/mongomancy/schema.py index 6c512e0..125a96b 100644 --- a/src/mongomancy/schema.py +++ b/src/mongomancy/schema.py @@ -69,6 +69,10 @@ def pymongo_collection(self, value: pymongo.collection.Collection) -> None: def name(self) -> str: return self.pymongo_collection.name + @property + def full_name(self) -> str: + return self.pymongo_collection.full_name + def find_one( self, where: Optional[types.BsonDict], @@ -448,7 +452,7 @@ def _insert_defaults( :return: docs created """ new_docs_cnt = 0 - coll_name = collection.mongo_collection.full_name + coll_name = collection.full_name for doc in docs: if not collection.find_one(doc.unique_key, {"_id": 1}): self.logger.debug(f"{coll_name} - inserting default {doc!r}")