Skip to content

Instantly share code, notes, and snippets.

@m-x-k
Last active August 21, 2018 11:58
Show Gist options
  • Save m-x-k/3639ab9aee254bad1593f0fb616200ce to your computer and use it in GitHub Desktop.
Save m-x-k/3639ab9aee254bad1593f0fb616200ce to your computer and use it in GitHub Desktop.
Pymongo load $date timestamp or isodate using bson.json_util.loads
from bson import json_util
# load as timestamp
print json_util.loads('{"$date": 1414516147000}')
# load as isodate
print json_util.loads('{"$date": "2014-10-28T17:09:07.000Z"}')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment