Say I have a document field name "creation_time". I would like to have its value initialized with the database current time, instead using the client machine time with:
datetime.datetime.utcnow()
How can I achieve this with PyMongo?
Moreover is there any way to do operations during the field initialization, for example:
"creation_time": magic_get_mongodb_time() + 10 hours
As a side note I'm OK to handle unix timestamps, not necessary datetime format.
EDIT: operations on dates are not possible yet (May 2015): http://ift.tt/1FTC07K
Aucun commentaire:
Enregistrer un commentaire