Update a MongoEngine document using a python dict?

前端 未结 6 1000
我在风中等你
我在风中等你 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:08

    To store python dict as a sub document one may use mongoengine.fields.DictField.

    Checkout manuals.

    A dictionary field that wraps a standard Python dictionary. This is similar to an embedded document, but the structure is not defined.

提交回复
热议问题