how to get particular dictionary from the list of dictionaries using mongoengine in django. As specified below data structure if I want to fetch the dictionary having the student_id as "1011". how to do and how to update that dictionary only one?
Data structure like that :
class studentData(Document):
student_class = StringField(required=True)
student_list = ListField()
Data store in DB sample:
{
"student_class":10.
"student_list":[
{
"student_id" : "1011",
"student_name" : "ABC"
},
{
"student_id" : "1045",
"student_name" : "XYZ"
}
]
}
I am try this is give me student_list but how to I get list of specific dictionary :
studen_list= studentData.objects.filter(student_class=10).values_list('student_list')[0]