Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- day = Date.UTC(this.time.getFullYear(), this.time.getMonth(), this.time.getDate());
- emit({ user : this.user, day : day }, { count : 1 });
- { "_id" : { "user" : "assaf", "day" : 1331769600000 }, "value" : { "count" : 15 } }
- { "_id" : { "user" : "assaf", "day" : 1331856000000 }, "value" : { "count" : 57 } }
- PRIMARY> new Date(db.my_collection.find()[0]["_id"]["day"])
- ISODate("2012-03-19T00:00:00Z")
- dict: {u'_id': {u'user': u'ariel', u'day': 1332115200000.0}, u'value': {u'count': 99.0}}
- >>> from __future__ import division
- >>> dict = {u'_id': {u'user': u'ariel', u'day': 1332115200000.0}, u'value': {u'count': 99.0}}
- >>> datetime.datetime.utcfromtimestamp(dict['_id']['day'] / 1000.0)
- datetime.datetime(2012, 3, 19, 0, 0)
- >>>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement