Skip to content

Instantly share code, notes, and snippets.

@lov3catch
Created January 27, 2015 19:55
Show Gist options
  • Save lov3catch/a6115700c7addcaf356f to your computer and use it in GitHub Desktop.
Save lov3catch/a6115700c7addcaf356f to your computer and use it in GitHub Desktop.
ObjectId to DateTime
# start_date = DateTimeField(default=datetime.datetime.now)
# http://api.mongodb.org/python/current/api/bson/objectid.html
orders = Order.objects()
for order in orders:
print 'generation: ',order.id.generation_time
print 'create: ',order.date
# order.date = order.id.generation_time
# order.save()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment