queryset.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:mongoengine_utils 作者: aiscenblue 项目源码 文件源码
def from_json(self, json_data):
        """Convert from JSON."""
        mongo_data = json.loads(
            json_data, object_hook=generate_object_hook(self._document)
        )
        exclude = [
            name for (name, fld) in self._document._fields.items() if any([
                getattr(fld, "exclude_from_json", None),
                getattr(fld, "exclude_json", None)
            ])
        ]
        for item in mongo_data:
            for exc in exclude:
                item.pop(exc, None)
        return [
            self._document._from_son(bson.SON(data)) for data in mongo_data
        ]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号