20 lines
510 B
Python
Executable File
20 lines
510 B
Python
Executable File
from __future__ import annotations
|
|
|
|
from pymongo.collection import Collection
|
|
|
|
from shared.mongodb import VisualCommunication
|
|
|
|
|
|
def upsert_visual_communication(
|
|
collection: Collection,
|
|
visual_communication_list: list[VisualCommunication],
|
|
) -> bool:
|
|
"""Upsert VisualCommunication object in the database.
|
|
|
|
Returns bool stating success.
|
|
"""
|
|
response = collection.insert_many(
|
|
[vis_com.model_dump() for vis_com in visual_communication_list],
|
|
)
|
|
return response.acknowledged
|