Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. day = Date.UTC(this.time.getFullYear(), this.time.getMonth(), this.time.getDate());
  2. emit({ user : this.user, day : day }, { count : 1 });
  3.  
  4. { "_id" : { "user" : "assaf", "day" : 1331769600000 }, "value" : { "count" : 15 } }
  5. { "_id" : { "user" : "assaf", "day" : 1331856000000 }, "value" : { "count" : 57 } }
  6.  
  7. PRIMARY> new Date(db.my_collection.find()[0]["_id"]["day"])
  8.  
  9. ISODate("2012-03-19T00:00:00Z")
  10.  
  11. dict: {u'_id': {u'user': u'ariel', u'day': 1332115200000.0}, u'value': {u'count': 99.0}}
  12.  
  13. >>> from __future__ import division
  14. >>> dict = {u'_id': {u'user': u'ariel', u'day': 1332115200000.0}, u'value': {u'count': 99.0}}
  15. >>> datetime.datetime.utcfromtimestamp(dict['_id']['day'] / 1000.0)
  16. datetime.datetime(2012, 3, 19, 0, 0)
  17. >>>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement