Update a MongoEngine document using a python dict?

前端 未结 6 1009
我在风中等你
我在风中等你 2021-02-05 18:24

Is it possible to update a MongoEngine document using a python dict?

For example:

class Pets(EmbeddedDocument):
    name = StringField()

class Person(Do         


        
6条回答
  •  囚心锁ツ
    2021-02-05 19:09

    Try something more like this

    p.update(**{
        "set__name": "Hank",
        "set__address": "Far away"
    })
    

提交回复
热议问题