original_string: 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;
      }
code: 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;
      }
code_tokens: 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 ; }
docstring: 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)
docstring_tokens: Removes the given document from the collection .