Skip to content

Commit

Permalink
fix: default collection data insert
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryu-CZ committed May 10, 2023
1 parent a225ca7 commit 8ca6d13
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/mongomancy/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down Expand Up @@ -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}")
Expand Down

0 comments on commit 8ca6d13

Please sign in to comment.