Deletes the document referred to by this DocumentReference.

@param documentReference The DocumentReference to delete.
@return The instance for chaining.
181097
@Nonnull
  public T delete(@Nonnull DocumentReference documentReference) {
    return performDelete(documentReference, Precondition.NONE);
  }
202867
public boolean removeReference(K key, ServiceReference<V> reference) {
        if (key == null || reference == null)
            return false;
        ConcurrentServiceReferenceElement<V> element = new ConcurrentServiceReferenceElement<V>(referenceName, reference);
        return elementMap.remove(key, element);
    }
153510
@Override
    public List<DocumentRevision> delete(final String id)
            throws DocumentNotFoundException, DocumentStoreException {
        Misc.checkNotNull(id, "ID");
        try {
            if (id.startsWith(CouchConstants._local_prefix)) {
                String localId = id.substring(CouchConstants._local_prefix.length());
                deleteLocalDocument(localId);
                // for local documents there is no "new document" to return as the document is
                // removed rather than updated with a tombstone
                return Collections.singletonList(null);
            } else {
                return get(queue.submitTransaction(new DeleteAllRevisionsCallable(id)));
            }
        } catch (ExecutionException e) {
            // documentnotfoundexception if it was a non-existent local document
            throwCauseAs(e, DocumentNotFoundException.class);
            String message = "Failed to delete document";
            logger.log(Level.SEVERE, message, e);
            throw new DocumentStoreException(message, e.getCause());
        }
    }
166748
public int chooseShardForDelete(DocumentID key) {
    int hashCode = key.hashCode();
    return hashCode >= 0 ? hashCode % numShards : (-hashCode) % numShards;
  }
1011757
public function delete()
    {
        if (!$this->isLoaded()) {
            //Nothing to do, do we need an exception here?
            return;
        }

        $this->dispatch('delete', new DocumentEvent($this));

        //Performing deletion
        $this->odm->collection(static::class)->deleteOne(['_id' => $this->primaryKey()]);
        $this->setField('_id', null, false);
        //Done with deletion

        $this->dispatch('deleted', new DocumentEvent($this));
    }
3466
public function delete(DocumentReference $document, array $options = [])
    {
        $this->writer->delete($document->name(), $options);

        return $this;
    }
80660
@Override
    protected void delete(Object entity, Object pKey)
    {
        EntityMetadata entityMetadata = KunderaMetadataManager.getEntityMetadata(kunderaMetadata, entity.getClass());
        String id = generateJsonDocId(entityMetadata.getTableName(), pKey.toString());
        bucket.remove(id);
        LOGGER.debug("Deleted document with ID : " + id + " from the " + bucket.name() + " Bucket");
    }
351991
@Override
  public SingleObjectBundle delete(DBIDRef id) {
    // Prepare bundle to return
    SingleObjectBundle bundle = new SingleObjectBundle();
    for(Relation<?> relation : relations) {
      bundle.append(relation.getDataTypeInformation(), relation.get(id));
    }
    doDelete(id);
    // fire deletion event
    eventManager.fireObjectRemoved(id);

    return bundle;
  }
548942
public static Object removeReference(List l, Object o) {
    Iterator iter = l.iterator();
    while (iter.hasNext()) {
      Object no = iter.next();
      if (no == o) {
        iter.remove();
        return o;
      }
    }
    return null;
  }
968666
public boolean deleteEdgeReference(AtlasEdge edge, DataTypes.TypeCategory typeCategory, boolean isComposite,
                                    boolean forceDeleteStructTrait) throws AtlasException {
        if (LOG.isDebugEnabled()) {
            LOG.debug("Deleting {}", string(edge));
        }

        boolean forceDelete =
                (typeCategory == DataTypes.TypeCategory.STRUCT || typeCategory == DataTypes.TypeCategory.TRAIT) && forceDeleteStructTrait;
        if (typeCategory == DataTypes.TypeCategory.STRUCT || typeCategory == DataTypes.TypeCategory.TRAIT
                || (typeCategory == DataTypes.TypeCategory.CLASS && isComposite)) {
            //If the vertex is of type struct/trait, delete the edge and then the reference vertex as the vertex is not shared by any other entities.
            //If the vertex is of type class, and its composite attribute, this reference vertex' lifecycle is controlled
            //through this delete, hence delete the edge and the reference vertex.
            AtlasVertex vertexForDelete = edge.getInVertex();

            //If deleting the edge and then the in vertex, reverse attribute shouldn't be updated
            deleteEdge(edge, false, forceDelete);
            deleteTypeVertex(vertexForDelete, typeCategory, forceDelete);
        } else {
            //If the vertex is of type class, and its not a composite attributes, the reference AtlasVertex' lifecycle is not controlled
            //through this delete. Hence just remove the reference edge. Leave the reference AtlasVertex as is

            //If deleting just the edge, reverse attribute should be updated for any references
            //For example, for the department type system, if the person's manager edge is deleted, subordinates of manager should be updated
            deleteEdge(edge, true, false);
        }
        return !softDelete || forceDelete;
    }
618290
public function delete()
    {
        if ($this->triggerEvent(self::EVENT_NAME_BEFORE_DELETE)->isCancelled()) {
            return $this;
        }

        $status = $this->collection->getMongoCollection()->remove(array(
            '_id'   => $this->getId(),
        ));

        if (true !== $status && $status['ok'] != 1) {
            throw new Exception(sprintf('Delete document error: %s', $status['err']));
        }

        $this->triggerEvent(self::EVENT_NAME_AFTER_DELETE);

        // drop from document's pool
        $this->getCollection()->removeDocumentFromDocumentPool($this);

        return $this;
    }
538577
public static DocumentNode toDocumentNode(List<Object> documentNodeParams)
    {
        DocumentNode node = new DocumentNode((String) documentNodeParams.get(NODE_TITLE_INDEX));
        node.setIsExecutable((Boolean) documentNodeParams.get(NODE_EXECUTABLE_INDEX));
        node.setCanBeImplemented((Boolean) documentNodeParams.get(NODE_CAN_BE_IMPLEMENTED_INDEX));
        if (documentNodeParams.size() == 5) {
            node.setURL((String) documentNodeParams.get(NODE_URL_INDEX));
        }

        Hashtable children = (Hashtable) documentNodeParams.get(NODE_CHILDREN_INDEX);
        @SuppressWarnings("unchecked")
        Collection<Vector<Object>> values = children.values();
        for (Vector<Object> nodeParams : values) {

            if(nodeParams.size() > 5 ) {
                node.addChildren(ReferenceNode.toReferenceNode(nodeParams));
            } else {
                node.addChildren(toDocumentNode(nodeParams));
            }
        }

        return node;
    }
308647
public WriteResult<T, K> remove(T object, WriteConcern concern) throws MongoException {
        return new WriteResult<T, K>(this, dbCollection.remove(convertToDbObject(object), concern));
    }
167147
DeleteResult deleteOne(final MongoNamespace namespace, final Bson filter) {
    this.waitUntilInitialized();

    try {
      ongoingOperationsGroup.enter();
      final ChangeEvent<BsonDocument> event;
      final DeleteResult result;
      final NamespaceSynchronizationConfig nsConfig =
          this.syncConfig.getNamespaceConfig(namespace);
      nsConfig.getLock().writeLock().lock();
      try {
        final MongoCollection<BsonDocument> localCollection = getLocalCollection(namespace);
        final BsonDocument docToDelete = localCollection
            .find(filter)
            .first();

        if (docToDelete == null) {
          return DeleteResult.acknowledged(0);
        }

        final BsonValue documentId = BsonUtils.getDocumentId(docToDelete);
        final CoreDocumentSynchronizationConfig config =
            syncConfig.getSynchronizedDocument(namespace, documentId);

        if (config == null) {
          return DeleteResult.acknowledged(0);
        }

        final MongoCollection<BsonDocument> undoCollection = getUndoCollection(namespace);
        undoCollection.insertOne(docToDelete);

        result = localCollection.deleteOne(filter);
        event = ChangeEvents.changeEventForLocalDelete(namespace, documentId, true);

        // this block is to trigger coalescence for a delete after insert
        if (config.getLastUncommittedChangeEvent() != null
            && config.getLastUncommittedChangeEvent().getOperationType()
            == OperationType.INSERT) {
          final LocalSyncWriteModelContainer localSyncWriteModelContainer =
              desyncDocumentsFromRemote(nsConfig, config.getDocumentId());
          localSyncWriteModelContainer.commitAndClear();

          // delete the namespace listener if necessary
          checkAndDeleteNamespaceListener(namespace);
          undoCollection.deleteOne(getDocumentIdFilter(config.getDocumentId()));
          return result;
        }

        config.setSomePendingWritesAndSave(logicalT, event);
        undoCollection.deleteOne(getDocumentIdFilter(config.getDocumentId()));
      } finally {
        nsConfig.getLock().writeLock().unlock();
      }
      eventDispatcher.emitEvent(nsConfig, event);
      return result;
    } finally {
      ongoingOperationsGroup.exit();
    }
  }
596627
private void removeDoc(String docID) {
    int rmNum = -1;
    int docNum = -1;
    for (int i = 0; i < documents.size(); i++) {
      XComponent xComponent = documents.get(i).getXComponent();
      if (xComponent != null && xComponent.equals(goneContext)) { //  disposed document found
        rmNum = i;
        break;
      }
    }
    if(rmNum < 0) {
      MessageHandler.printToLogFile("Error: Disposed document not found");
      goneContext = null;
    }
    for (int i = 0; i < documents.size(); i++) {
      if (documents.get(i).getDocID().equals(docID)) {  //  document exist
        docNum = i;
        break;
      }
    }
    if(rmNum >= 0 && docNum != rmNum ) {  // don't delete a closed document before the last check is done
      documents.remove(rmNum);
      goneContext = null;
      if (debugMode) {
        MessageHandler.printToLogFile("Document " + rmNum + " deleted");
      }
    }
  }
1301343
public boolean deleteEdgeReference(AtlasEdge edge, TypeCategory typeCategory, boolean isOwned,
                                       boolean forceDeleteStructTrait) throws AtlasBaseException {

        // default edge direction is outward
        return deleteEdgeReference(edge, typeCategory, isOwned, forceDeleteStructTrait, AtlasRelationshipEdgeDirection.OUT);
    }
291126
protected void clearReference (DObject reffer, String field, int reffedOid)
    {
        // look up the reference vector for the referenced object
        Reference[] refs = _refs.get(reffedOid);
        Reference ref = null;

        if (refs != null) {
            for (int ii = 0; ii < refs.length; ii++) {
                if (refs[ii].equals(reffer.getOid(), field)) {
                    ref = refs[ii];
                    refs[ii] = null;
                    break;
                }
            }
        }

        // if a referred object and referring object are both destroyed without allowing the
        // referred object destruction to process the ObjectRemoved event which is auto-generated,
        // the subsequent destruction of the referring object will attempt to clear the reference
        // to the referred object which no longer exists; so we don't complain about non- existent
        // references if the referree is already destroyed
        if (ref == null && _objects.containsKey(reffedOid)) {
            log.warning("Requested to clear out non-existent reference",
                        "refferOid", reffer.getOid(), "field", field, "reffedOid", reffedOid);

//        } else {
//            log.info("Cleared out reference " + ref + ".");
        }
    }