Created
October 10, 2022 03:16
-
-
Save JRudransh/eb9d674a630142c09bd19b633293c46e to your computer and use it in GitHub Desktop.
Python Serializer for MongoDB which cal serialize every result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def InsecureDictSerializer(item) -> dict: | |
return {**{i: str(item[i]) for i in item if i == '_id'}, **{i: item[i] for i in item if i != '_id'}} | |
def InsecureListSerializer(items) -> list: | |
return [InsecureDictSerializer(item) for item in items] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment