Remove an association instance between two resources
@param ownerModel
@param ownerObject
@param childModel
@param childId
@param associationName
@param Log
@returns {*|promise}
@private
334690
async function _removeAssociation(
  ownerModel,
  ownerObject,
  childModel,
  childId,
  associationName,
  Log
) {
  let childObject = await childModel.findOne({ _id: childId })
  if (childObject) {
    let association = ownerModel.routeOptions.associations[associationName]
    let associationType = association.type
    if (associationType === 'ONE_MANY') {
      // EXPL: one-many associations are virtual, so only update the child reference
      // childObject[association.foreignField] = null; //TODO: set reference to null instead of deleting it?
      // EXPL: only delete the reference if the ids match
      if (
        childObject[association.foreignField] &&
        childObject[association.foreignField].toString() ===
          ownerObject._id.toString()
      ) {
        childObject[association.foreignField] = undefined
      }
      await childObject.save()
    } else if (associationType === 'MANY_MANY') {
      // EXPL: remove references from both models

      // EXPL: if linking models aren't embeded, just upsert the linking model collection
      let embedAssociation =
        association.embedAssociation === undefined
          ? config.embedAssociations
          : association.embedAssociation
      if (!embedAssociation) {
        const linkingModel = association.include.through
        let query = {}
        query[ownerModel.modelName] = ownerObject._id
        query[childModel.modelName] = childObject._id

        await linkingModel.findOneAndRemove(query)
      } else {
        // EXPL: remove the associated child from the owner
        let deleteChild = ownerObject[associationName].filter(child => {
          return (
            child[childModel.modelName].toString() ===
            childObject._id.toString()
          )
        })
        deleteChild = deleteChild[0]

        let index = ownerObject[associationName].indexOf(deleteChild)
        if (index > -1) {
          ownerObject[associationName].splice(index, 1)
        }

        // EXPL: get the child association name
        let childAssociation = {}
        let childAssociations = childModel.routeOptions.associations
        for (let childAssociationKey in childAssociations) {
          let association = childAssociations[childAssociationKey]
          if (association.model === ownerModel.modelName) {
            childAssociation = association
          }
        }
        let childAssociationName = childAssociation.include.as

        // EXPL: remove the associated owner from the child
        let deleteOwner = childObject[childAssociationName].filter(owner => {
          return (
            owner[ownerModel.modelName].toString() ===
            ownerObject._id.toString()
          )
        })
        deleteOwner = deleteOwner[0]

        index = childObject[childAssociationName].indexOf(deleteOwner)
        if (index > -1) {
          childObject[childAssociationName].splice(index, 1)
        }

        await Promise.all([
          ownerModel.findByIdAndUpdate(ownerObject._id, ownerObject, {
            runValidators: config.enableMongooseRunValidators
          }),
          childModel.findByIdAndUpdate(childObject._id, childObject, {
            runValidators: config.enableMongooseRunValidators
          })
        ])
      }
    } else if (associationType === '_MANY') {
      // EXPL: remove reference from owner model

      // EXPL: remove the associated child from the owner
      let deleteChild = ownerObject[associationName].filter(childId => {
        return childId.toString() === childObject._id.toString()
      })
      deleteChild = deleteChild[0]

      let index = ownerObject[associationName].indexOf(deleteChild)
      if (index > -1) {
        ownerObject[associationName].splice(index, 1)
      }

      await Promise.all([
        ownerModel.findByIdAndUpdate(ownerObject._id, ownerObject, {
          runValidators: config.enableMongooseRunValidators
        })
      ])
    } else {
      throw Boom.badRequest('Association type incorrectly defined.')
    }
  } else {
    throw Boom.notFound('Child object not found.')
  }
}
28761
public void removeAssociationRow(GraphDatabaseService executionEngine, AssociationKey associationKey, RowKey rowKey) {
		Object[] relationshipValues = relationshipValues( associationKey, rowKey );
		Object[] queryValues = ArrayHelper.concat( associationKey.getEntityKey().getColumnValues(), relationshipValues );
		executionEngine.execute( removeAssociationRowQuery, params( queryValues ) );
	}
515882
@SuppressWarnings("WeakerAccess")
    @MainThread
    public void removeObservers(@NonNull final LifecycleOwner owner) {
        assertMainThread("removeObservers");
        for (Map.Entry<Observer<T>, ObserverWrapper> entry : mObservers) {
            if (entry.getValue().isAttachedTo(owner)) {
                removeObserver(entry.getKey());
            }
        }
    }
1167602
public void removeChild(RamResourceCore core) {

	if (children == null) return;

	RamResourceCore child;
	for (int i = children.size() - 1; i >= 0; i--) {
	    child = (RamResourceCore) children.get(i);
	    if (child == core) {
		children.remove(i);
		break;
	    }
	}
    }
1305088
public void removeRelationship(String baseTableName,
			String relatedTableName, String relationName) {

		try {
			if (extendedRelationsDao.isTableExists()) {
				List<ExtendedRelation> extendedRelations = getRelations(
						baseTableName, relatedTableName, relationName, null);
				for (ExtendedRelation extendedRelation : extendedRelations) {
					removeRelationship(extendedRelation);
				}
			}
		} catch (SQLException e) {
			throw new GeoPackageException("Failed to remove relationship '"
					+ relationName + "' between " + baseTableName + " and "
					+ relatedTableName, e);
		}

	}
583397
private function completeOwningSide(AssociationMetadata $property, $targetObject)
    {
        // add this object on the owning side as well, for obvious infinite recursion
        // reasons this is only done when called on the inverse side.
        if ($property->isOwningSide()) {
            return;
        }

        $mappedByField    = $property->getMappedBy();
        $targetMetadata   = self::$entityManager->getClassMetadata($property->getTargetEntity());
        $targetProperty   = $targetMetadata->getProperty($mappedByField);
        $setterMethodName = ($targetProperty instanceof ToManyAssociationMetadata ? 'add' : 'set') . $mappedByField;

        $targetObject->{$setterMethodName}($this);
    }
924517
def delete_relationship(cls, id, related_collection_name, related_resource=None):
        
        try:
            this_resource = cls.nodes.get(id=id, active=True)
            if not related_resource:
                r = this_resource.delete_relationship_collection(related_collection_name)
            else:
                r = this_resource.delete_individual_relationship(related_collection_name, related_resource)
        except DoesNotExist:
            r = application_codes.error_response([application_codes.RESOURCE_NOT_FOUND])
        return r
842183
private void deletePolymorphicChildrenShallow(OneToManyPolymorphicAssociation association){
        String targetTable = metaModelOf(association.getTargetClass()).getTableName();
        String parentType = association.getTypeLabel();
        new DB(metaModelLocal.getDbName()).exec("DELETE FROM " + targetTable + " WHERE parent_id = ? AND parent_type = ?", getId(), parentType);
    }
283154
function remove(clientModelDoc, callback) {
      var cb = callback || angular.noop;

      return ClientModelDoc.remove({id: clientModelDoc._id},
        function (clientModelDoc) {
          return cb(clientModelDoc);
        },
        function (err) {
          return cb(err);
        }).$promise;
    }
1268079
def channels_remove_owner(self, room_id, user_id, **kwargs):
        """"""
        return self.__call_api_post('channels.removeOwner', roomId=room_id, userId=user_id, kwargs=kwargs)
908581
function removeFriendship(m1, m2) {
    return this.update({ _id: m1 }, {
      $pull: _defineProperty({}, pathName, { _id: m2 })
    });
  }
543839
public void unbind(final ValidationObject validationObject, final ProxyField proxyField, final FieldReference fieldReference, final ValidationObject owner)
    {
        final RuleProxyField ruleProxyField = getRuleProxyField(proxyField);
        for (Rule rule: fieldReference.getListeners())
        {
            RuleContext ruleContext;
			try {
				ruleContext = getRuleContext(rule,validationObject,(owner==null)?validationObject:owner);
			} catch (FailsToMatchException e) {
				continue;
			}
            ruleProxyField.removeInputRule(ruleContext);
        }
        removeRuleProxyField(proxyField);
    }
521666
function removeChild(parent, child) {
        var parentChildIdx = parent._children.indexOf(child)
        parent._children.splice(parentChildIdx, 1)
        incChildrenVersion(parent)
        return parent
    }
676768
public void removeLockedObjectOwner( String owner ) {

        try {
            if (this.owner != null) {
                int size = this.owner.length;
                for (int i = 0; i < size; i++) {
                    // check every owner if it is the requested one
                    if (this.owner[i].equals(owner)) {
                        // remove the owner
                        size -= 1;
                        String[] newLockedObjectOwner = new String[size];
                        for (int j = 0; j < size; j++) {
                            if (j < i) {
                                newLockedObjectOwner[j] = this.owner[j];
                            } else {
                                newLockedObjectOwner[j] = this.owner[j + 1];
                            }
                        }
                        this.owner = newLockedObjectOwner;

                    }
                }
                if (this.owner.length == 0) {
                    this.owner = null;
                }
            }
        } catch (ArrayIndexOutOfBoundsException e) {
            LOGGER.error(e, new TextI18n("LockedObject.removeLockedObjectOwner()"));
        }
    }
769079
private void removeAllRelatedFromCache(String userName)
   {
      cache.remove(userName, CacheType.USER_PROFILE);
      cache.remove(CacheHandler.USER_PREFIX + userName, CacheType.MEMBERSHIP);
   }
680122
void release(Object owner, Field field) {
        Map<String, Integer> fields = owners.get(owner);
        if(fields != null) {
            release();

            Integer count = fields.get(field.toGenericString());
            if(--count > 0) {
                fields.put(field.toGenericString(), count);
            } else {
                fields.remove(field.toGenericString());
            }
        }

        if(fields != null && fields.isEmpty()) {
            owners.remove(owner);
        }
    }
216882
def remove_child(child)
      child = child.name if child.is_a?(Model)
      children.delete(child)
    end