func (m *MgoQuestionStore) UpdateAnswer(questionID string, ans *model.Answer) error { ans.SetUpdated() return m.c.Update(bson.M{"_id": questionID, "Answers._id": ans.ID}, bson.M{"$set": bson.M{"Answers.$": ans, "UpdatedAt": ans.UpdatedAt}}) }
func (m *MgoQuestionStore) AddAnswer(questionID string, ans *model.Answer) error { ans.SetNew() return m.c.UpdateId(questionID, bson.M{"$push": bson.M{ "Answers": ans, }, "UpdatedAt": ans.UpdatedAt}) }