Skip to content

Commit a030bc6

Browse files
committed
fix(mongo_model) : return empty array if the array is empty
1 parent 059f8eb commit a030bc6

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

fastapi_crudrouter_mongodb/core/models/mongo_model.py

+2
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ def convert_to(self, model: BaseModel):
6767
return model(**new_model)
6868

6969
def _convert_list(self, list_to_convert: list):
70+
if(len(list_to_convert) <= 0):
71+
return []
7072
if not isinstance(list_to_convert[0], dict):
7173
return list_to_convert
7274
new_list = []

0 commit comments

Comments
 (0)