-
-
Save pavan538/bbf764063cf36fc4ca67755cee278328 to your computer and use it in GitHub Desktop.
Code fragment for a MongoEngine query result item to serializable JSON dictionary.
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
data = o.to_mongo() | |
o_id = data.pop('_id', None) | |
if o_id: | |
data['id'] = str(o_id) | |
data.pop('_cls', None) | |
return data |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment