You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@attr.s
class User(object):
_id = attr.ib()
name = attr.ib()
@classmethod
def from_mongo(cls, doc):
return cls(**{k if not k.startswith('_') else k[1:]: v for k, v in doc.items()})
when working with mongodb, how could I create instance for this from mongodb document?
because we know that
User(**doc)
doesn't work due to the underscore.The text was updated successfully, but these errors were encountered: