Hello gurus out there.
I am trying to add subdocuments through a dynamic array. Following is something I want to achieve. Not able to understand how to get array create subdocuments instead of getting it to print JSON code written in double quotes. I understand why it is printing code but not able tell the program to convert the string into subdocuments.
Thank you for looking.
rec = {
'_id' : 1,
'class' : 'Python'
}
rec['students'] = "[{'name':'Jack','marks':90},{'name':'Jill', marks: 80}]"
db.class.insert(rec)