首页 > mongoengine 更新数组问题

mongoengine 更新数组问题

 Account.objects(pk=dest_user_id).update_one(add_to_set__fans=current_user) #添加粉丝
Account.objects(pk=current_user.pk).update_one(add_to_set__follows=dest_user) #添加被关注者

我在flask应用中,上面的两个更新语句报错,下面是用户实体

class Account(Document):
    follows = ListField(ReferenceField("self")) #关注
    fans = ListField(ReferenceField("self"))  #粉丝

备注:上述是在flask 中 mongoengine 环境中报异常 InvalidQueryError: Cannot resolve field "fans"

请问是什么原因呢?

【热门文章】
【热门文章】