original_string: public function update($entity, array $options = []): bool
      {
          if (false === $this->fireEvent('updating', $entity, true)) {
              return false;
          }
  
          if (!$entity->_id) {
              if ($result = $this->insert($entity, $options, false)) {
                  $this->afterSuccess($entity);
  
                  $this->fireEvent('updated', $entity);
              }
  
              return $result;
          }
  
          $data = $this->parseToDocument($entity);
  
          $queryResult = $this->getCollection()->updateOne(
              ['_id' => $data['_id']],
              ['$set' => $data],
              $this->mergeOptions($options)
          );
  
          $result = $queryResult->isAcknowledged() && $queryResult->getModifiedCount();
  
          if ($result) {
              $this->afterSuccess($entity);
  
              $this->fireEvent('updated', $entity);
          }
  
          return $result;
      }
code: public function update($entity, array $options = []): bool
      {
          if (false === $this->fireEvent('updating', $entity, true)) {
              return false;
          }
  
          if (!$entity->_id) {
              if ($result = $this->insert($entity, $options, false)) {
                  $this->afterSuccess($entity);
  
                  $this->fireEvent('updated', $entity);
              }
  
              return $result;
          }
  
          $data = $this->parseToDocument($entity);
  
          $queryResult = $this->getCollection()->updateOne(
              ['_id' => $data['_id']],
              ['$set' => $data],
              $this->mergeOptions($options)
          );
  
          $result = $queryResult->isAcknowledged() && $queryResult->getModifiedCount();
  
          if ($result) {
              $this->afterSuccess($entity);
  
              $this->fireEvent('updated', $entity);
          }
  
          return $result;
      }
code_tokens: public function update ( $ entity , array $ options = [ ] ) : bool { if ( false === $ this -> fireEvent ( 'updating' , $ entity , true ) ) { return false ; } if ( ! $ entity -> _id ) { if ( $ result = $ this -> insert ( $ entity , $ options , false ) ) { $ this -> afterSuccess ( $ entity ) ; $ this -> fireEvent ( 'updated' , $ entity ) ; } return $ result ; } $ data = $ this -> parseToDocument ( $ entity ) ; $ queryResult = $ this -> getCollection ( ) -> updateOne ( [ '_id' => $ data [ '_id' ] ] , [ '$set' => $ data ] , $ this -> mergeOptions ( $ options ) ) ; $ result = $ queryResult -> isAcknowledged ( ) && $ queryResult -> getModifiedCount ( ) ; if ( $ result ) { $ this -> afterSuccess ( $ entity ) ; $ this -> fireEvent ( 'updated' , $ entity ) ; } return $ result ; }
docstring: Updates the given object into database. Returns success if write concern
  is acknowledged. Since it's an update, it will fail if the document with
  the given _id did not exists.
  
  Notice: Updates with Unacknowledged WriteConcern will not fire `updated` 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: Updates the given object into database . Returns success if write concern is acknowledged . Since it s an update it will fail if the document with the given _id did not exists .