Skip to content

Commit

Permalink
Fix type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jefersondaniel committed Apr 25, 2024
1 parent bbc6efc commit 3123ed8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pydantic_mongo/abstract_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def save(self, model: T) -> Union[InsertOneResult, UpdateResult]:
)

result = self.get_collection().insert_one(document)
model.id = result.inserted_id
model_with_id.id = result.inserted_id
return result

def save_many(self, models: Iterable[T]):
Expand All @@ -143,7 +143,7 @@ def save_many(self, models: Iterable[T]):
)

for idx, inserted_id in enumerate(result.inserted_ids):
models_to_insert[idx].id = inserted_id
cast(ModelWithId, models_to_insert[idx]).id = inserted_id

if len(models_to_update) == 0:
return
Expand Down
2 changes: 1 addition & 1 deletion requirements_test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pytest==8.1.1
pytest-cov==4.1.0
pytest-mock==3.12.0
mongomock==4.1.2
pydantic>=2.0.2
pydantic==2.7.1
pymongo==4.6.3
mypy==1.10.0
mypy-extensions==1.0.0
Expand Down

0 comments on commit 3123ed8

Please sign in to comment.