コード例 #1
0
ファイル: commentDao.go プロジェクト: xing4git/chirp
func InsertComment(comment model.Comment) (ret model.Comment, err error) {
	s := mongo.GetSession()
	defer s.Close()
	c := collection(s, util.MONGO_COLLECTION_COMMENT)

	comment.Cid = bson.NewObjectId()
	comment.Ctime = util.UnixMillSeconds()

	return comment, c.Insert(comment)
}