class Schedule(EmbeddedDocument):
scheduleId: StringField(required=True)
detail: StringField()
class AccountBalance(Document):
memberID = StringField(required=True)
schedule = ListField(EmbeddedDocumentField(Schedule))
array = []
for index, row in df.iterrows():
# handle schedule
schedule = Schedule()
schedule.scheduleId = "1234667777"
schedule.detail = "some random detail"
payload = {
"memberID": "98765",
"schedule": schedule,
}
array.append(payload)
person_instances = [TrialBalance(**data) for data in array]
AccountBalance.objects.insert(person_instances, load_bulk=False)
If I comment out code for schedule class (Embedded document), the code works like charm but when I try to run this code, it throws an error
The source SON object needs to be of type 'dict' but a '<class 'str'>' was found
Can someone tell me how to use the embedded document in bulk insert or how to fix this error??
I'm using this model
If I comment out code for schedule class (Embedded document), the code works like charm but when I try to run this code, it throws an error
The source SON object needs to be of type 'dict' but a '<class 'str'>' was found
Can someone tell me how to use the embedded document in bulk insert or how to fix this error??