// RemoveServiceFromGroup remove service from an existing service group
RemoveServiceFromGroup remove service from an existing service group
// RemoveServiceFromGroup remove service from an existing service group
func (sgmr *ServiceGroupMongoRepository) RemoveServiceFromGroup(serviceGroupID string, serviceID string) error {
	serviceGroupIdHex := bson.ObjectIdHex(serviceGroupID)
	serviceIdHex := bson.ObjectIdHex(serviceID)
	updateGroup := bson.M{"$pull": bson.M{"services": serviceIdHex}}
	updateService := bson.M{"$set": bson.M{"groupid": nil, "usegroupattributes": false}}
	err := sgmr.Db.C(constants.SERVICES_COLLECTION).UpdateId(serviceIdHex, updateService)
	if err != nil {
		return err
	}
	return sgmr.Collection.UpdateId(serviceGroupIdHex, updateGroup)
}
func ( sgmr * ServiceGroupMongoRepository ) RemoveServiceFromGroup ( serviceGroupID string , serviceID string ) error { serviceGroupIdHex := bson . ObjectIdHex ( serviceGroupID ) serviceIdHex := bson . ObjectIdHex ( serviceID ) updateGroup := bson . M { " " : bson . M { " " : serviceIdHex } } updateService := bson . M { " " : bson . M { " " : nil , " " : false } } err := sgmr . Db . C ( constants . SERVICES_COLLECTION ) . UpdateId ( serviceIdHex , updateService ) if err != nil { return err } return sgmr . Collection . UpdateId ( serviceGroupIdHex , updateGroup ) }
RemoveServiceFromGroup remove service from an existing service group
RemoveServiceFromGroup remove service from an existing service group