Reputation:
I am trying to update a key of a DictField using monogoengine update_one() method. what should the set__field be?
Articles.objects(id=request.data['id']).update_one()
for the field
something{'to_be_updated_key' : false}
Upvotes: 1
Views: 49
Reputation: 6374
Syntax should be set__{dictfield_name}__{key}
:
class FancyDoc(Document):
dic = DictField()
doc = FancyDoc(dic={'key1': 1, 'key2': 2}).save()
FancyDoc.objects(id=doc.id).update_one(set__dic__key2=99)
Upvotes: 1