dbprovider/mongodb/user.go
func (m MongoDb) SaveUser(user models.User) error {
	c := m.Connect(models.COLL_NAME_USER)
	defer m.Close(c)

	_, err := c.Upsert(bson.M{"username": user.Username}, bson.M{"$set": user})
	if err != nil {
		logger.Get().Error("Error deleting record from DB for user: %s. error: %v", user.Username, err)
		return mkmgoerror(err.Error())
	}
	return nil
}
func (m MongoDb) SaveUser(user models.User) error {
	c := m.Connect(models.COLL_NAME_USER)
	defer m.Close(c)

	_, err := c.Upsert(bson.M{"username": user.Username}, bson.M{"$set": user})
	if err != nil {
		logger.Get().Error("Error deleting record from DB for user: %s. error: %v", user.Username, err)
		return mkmgoerror(err.Error())
	}
	return nil
}
// SaveUser adds a new user, replacing if the same username is in use.