I was curious, so I made an experiment memo.
from pymongo import MongoClient
from datetime import datetime
client = MongoClient()
col = client.db.collection
item = col.insert_one({ 'date': datetime.now() })
Looking at adminMongo, it looks like this. The date inserted in the date key is an ISODate object.
By the way, if you read this data with python
items = list(col.find())
items
#[{'_id': ObjectId('574d28258cc7157fb9c98b40'),
# 'date': datetime.datetime(2016, 5, 31, 14, 59, 1, 572000)},
# {'_id': ObjectId('574d28e88cc7157fb9c98b41'),
# 'date': datetime.datetime(2016, 5, 31, 15, 2, 16, 862000)}]
It will be returned as a datetime object.
Recommended Posts