public function delete($entity, array $options = []): bool
    {
        if (false === $this->fireEvent('deleting', $entity, true)) {
            return false;
        }

        $data = $this->parseToDocument($entity);

        $queryResult = $this->getCollection()->deleteOne(
            ['_id' => $data['_id']],
            $this->mergeOptions($options)
        );

        if ($queryResult->isAcknowledged() &&
            $queryResult->getDeletedCount()
        ) {
            $this->fireEvent('deleted', $entity);

            return true;
        }

        return false;
    }
public function delete($entity, array $options = []): bool
    {
        if (false === $this->fireEvent('deleting', $entity, true)) {
            return false;
        }

        $data = $this->parseToDocument($entity);

        $queryResult = $this->getCollection()->deleteOne(
            ['_id' => $data['_id']],
            $this->mergeOptions($options)
        );

        if ($queryResult->isAcknowledged() &&
            $queryResult->getDeletedCount()
        ) {
            $this->fireEvent('deleted', $entity);

            return true;
        }

        return false;
    }
public function delete ( $ entity , array $ options = [ ] ) : bool { if ( false === $ this -> fireEvent ( 'deleting' , $ entity , true ) ) { return false ; } $ data = $ this -> parseToDocument ( $ entity ) ; $ queryResult = $ this -> getCollection ( ) -> deleteOne ( [ '_id' => $ data [ '_id' ] ] , $ this -> mergeOptions ( $ options ) ) ; if ( $ queryResult -> isAcknowledged ( ) && $ queryResult -> getDeletedCount ( ) ) { $ this -> fireEvent ( 'deleted' , $ entity ) ; return true ; } return false ; }
Removes the given document from the collection.

Notice: Deletes with Unacknowledged WriteConcern will not fire `deleted` event.

@param mixed $entity  the entity used in the operation
@param array $options possible options to send to mongo driver

@return bool Success (but always false if write concern is Unacknowledged)
Removes the given document from the collection .