// AddServiceToGroup add service with id serviceID to application group with id appGroupID
AddServiceToGroup add service with id serviceID to application group with id appGroupID
// AddServiceToGroup add service with id serviceID to application group with id appGroupID
func (agmr *AppGroupMongoRepository) AddServiceToGroup(appGroupID string, serviceID string) error {
	serviceGroupIDHex := bson.ObjectIdHex(appGroupID)
	serviceIDHx := bson.ObjectIdHex(serviceID)
	removeFromAllGroups := bson.M{"$pull": bson.M{"services": serviceIDHx}}
	updateGroup := bson.M{"$addToSet": bson.M{"services": serviceIDHx}}
	_, err := agmr.Collection.UpdateAll(bson.M{}, removeFromAllGroups)
	if err != nil {
		return err
	}
	return agmr.Collection.UpdateId(serviceGroupIDHex, updateGroup)
}
func ( agmr * AppGroupMongoRepository ) AddServiceToGroup ( appGroupID string , serviceID string ) error { serviceGroupIDHex := bson . ObjectIdHex ( appGroupID ) serviceIDHx := bson . ObjectIdHex ( serviceID ) removeFromAllGroups := bson . M { " " : bson . M { " " : serviceIDHx } } updateGroup := bson . M { " " : bson . M { " " : serviceIDHx } } _ , err := agmr . Collection . UpdateAll ( bson . M { } , removeFromAllGroups ) if err != nil { return err } return agmr . Collection . UpdateId ( serviceGroupIDHex , updateGroup ) }
AddServiceToGroup add service with id serviceID to application group with id appGroupID
AddServiceToGroup add service with id serviceID to application group with id appGroupID