不要将时间存储为字符串。mgo支持time.Time,它类似于
DateJavascript中的对象:
type Event struct { Id bson.ObjectId "_id,omitempty" Which string Date time.Time}插入一个现在发生的事件:
e := Event{ Which: "first event", Date: time.Now(),}c.Insert(e)
不要将时间存储为字符串。mgo支持time.Time,它类似于
DateJavascript中的对象:
type Event struct { Id bson.ObjectId "_id,omitempty" Which string Date time.Time}插入一个现在发生的事件:
e := Event{ Which: "first event", Date: time.Now(),}c.Insert(e)